Read tool does not attribute content to file path #7982

Open
opened 2026-02-16 18:08:50 -05:00 by yindo · 3 comments
Owner

Originally created by @drybalka on GitHub (Jan 29, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

When attaching multiple files with @ command their content is returned to model without attribution to which file it belongs.

For example, in an empty folder create two files:

// a.txt
28

// b.txt
42

Then ask the model to give you their contents with What numbers are written in files @a.txt and @b.txt ?. In my case with Claude Sonnet 4.5 it returns their contents switched:

The files contain:
- a.txt: 42
- b.txt: 28

Here is the relevant part of this request intercepted with mitmproxy:

        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "What numbers are written in files @a.txt and @b.txt ?"
                },
                {
                    "type": "text",
                    "text": "Called the Read tool with the following input:
{\"filePath\":\".../test/a.txt\"}"
                },
                {
                    "type": "text",
                    "text": "Called the Read tool with the following input:
{\"filePath\":\".../test/b.txt\"}"
                },
                {
                    "type": "text",
                    "text": "<file>\n00001| 42\n00002| \n\n(End of file - total 2 lines)\n</file>"
                },
                {
                    "type": "text",
                    "text": "<file>\n00001| 28\n00002| \n\n(End of file - total 2 lines)\n</file>"
                }
            ]
        }

As you can see it is impossible to say which content is which.

Plugins

None

OpenCode version

1.1.40

Steps to reproduce

See above.

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @drybalka on GitHub (Jan 29, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description When attaching multiple files with `@` command their content is returned to model without attribution to which file it belongs. For example, in an empty folder create two files: ``` // a.txt 28 // b.txt 42 ``` Then ask the model to give you their contents with `What numbers are written in files @a.txt and @b.txt ?`. In my case with Claude Sonnet 4.5 it returns their contents switched: ``` The files contain: - a.txt: 42 - b.txt: 28 ``` Here is the relevant part of this request intercepted with mitmproxy: ```json { "role": "user", "content": [ { "type": "text", "text": "What numbers are written in files @a.txt and @b.txt ?" }, { "type": "text", "text": "Called the Read tool with the following input: {\"filePath\":\".../test/a.txt\"}" }, { "type": "text", "text": "Called the Read tool with the following input: {\"filePath\":\".../test/b.txt\"}" }, { "type": "text", "text": "<file>\n00001| 42\n00002| \n\n(End of file - total 2 lines)\n</file>" }, { "type": "text", "text": "<file>\n00001| 28\n00002| \n\n(End of file - total 2 lines)\n</file>" } ] } ``` As you can see it is impossible to say which content is which. ### Plugins None ### OpenCode version 1.1.40 ### Steps to reproduce See above. ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the bug label 2026-02-16 18:08:50 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 29, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #8615: Research agents report incorrect file paths

This issue also seems related to #9644 which requests showing which tool was used for each block of output, which could help provide better attribution.

Feel free to ignore if these don't address your specific case.

@github-actions[bot] commented on GitHub (Jan 29, 2026): This issue might be a duplicate of existing issues. Please check: - #8615: Research agents report incorrect file paths This issue also seems related to #9644 which requests showing which tool was used for each block of output, which could help provide better attribution. Feel free to ignore if these don't address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Feb 2, 2026):

fixed by: https://github.com/anomalyco/opencode/commit/612b656d3670f252541be79f96bfda31d78dcf73

@rekram1-node commented on GitHub (Feb 2, 2026): fixed by: https://github.com/anomalyco/opencode/commit/612b656d3670f252541be79f96bfda31d78dcf73
Author
Owner

@rekram1-node commented on GitHub (Feb 2, 2026):

actually there was a bug in that lol, will fix shortly

@rekram1-node commented on GitHub (Feb 2, 2026): actually there was a bug in that lol, will fix shortly
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7982