#12426·onyx

read_file tool always fails with "file not in available files" for chat-uploaded files

Author: AsifKagan8Created Jun 25, 2026Updated Sep 11, 2026
LabelsStale

bug: When a user uploads a file in chat, the LLM is told to use the user_file_id UUID as the file identifier. However, _collect_available_file_ids only collects the file_record ID (fd["id"]) — never the user_file_id. Every read_file call therefore fails with:

ToolCallException: File <user_file_id> not in available files

Root cause: Two functions are out of sync.

backend/onyx/chat/chat_utils.py (~line 666) — tells the LLM to use user_file_id:
## Use user_file_id as the FileReaderTool accepts that.
tool_id = fd.get("user_file_id") or text_file.file_id
backend/onyx/chat/process_message.py — _collect_available_file_ids only collects fd["id"]:
for fd in msg.files:
    try:
        chat_file_ids.add(UUID(fd["id"]))  # file_record ID only
    except (ValueError, KeyError):
        pass
## user_file_id is never added to user_file_ids

Fix

for fd in msg.files:
    try:
        chat_file_ids.add(UUID(fd["id"]))
    except (ValueError, KeyError):
        pass
    user_file_id_str = fd.get("user_file_id")
    if user_file_id_str:
        try:
            user_file_ids.add(UUID(user_file_id_str))
        except ValueError:
            pass

Version: Confirmed in v4.1.1 through v4.1.7 and current main.