Skip to content

TypeError: Failed to fetch #27474

Closed as not planned
Closed as not planned

Description

@QFinn-Penguin

Description

点击explore或者是智能体的时候,如果没跳到子agent里面的话,就会报错:
TypeError: Failed to fetch
at fetch (oc://renderer/assets/main-DlaiLIQY.js:102686:45)
at request (oc://renderer/assets/main-DlaiLIQY.js:58972:24)
at async retry (oc://renderer/assets/main-DlaiLIQY.js:63575:14)
at async fetchMessages (oc://renderer/assets/main-DlaiLIQY.js:65394:24)
at async loadMessages (oc://renderer/assets/main-DlaiLIQY.js:65418:7)
at async Promise.all (index 1)
at async oc://renderer/assets/main-DlaiLIQY.js:65576:13

Plugins

No response

OpenCode version

1.14.50

Steps to reproduce

1.点击Explore或智能体,就会报错,经常会这样

Image Image

Screenshot and/or share link

No response

Operating System

windows11

Terminal

No response

Activity

  1. github-actions commented on May 14, 2026

    @github-actions
    Contributor

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

    If your issue is the same, please add a reaction or comment on one of those issues so it can be tracked there.

  2. QFinn-Penguin commented on May 14, 2026

    @QFinn-Penguin
    Author

    此问题可能与现有问题重复。请检查:

    如果您遇到的问题相同,请在这些问题下方添加点赞或评论,以便我们跟踪您的问题。

    确实是相同的问题,希望能尽快解决,实在是很影响使用,一下子就崩溃了

  3. masterleelee commented on May 15, 2026

    @masterleelee

    我也是,新开的opencode就可以对话一次,第二次就报错。failed to fetch。我让他卸载ohmyopencode 重新打开就可以正常对话了。

  4. QFinn-Penguin commented on May 18, 2026

    @QFinn-Penguin
    Author

    我也是,新开的opencode就可以对话一次,第二次就报错。failed to fetch。我让他卸载ohmyopencode 重新打开就可以正常对话了。

    好像不要点进去看子agent就没事

  5. lrq3000 commented on Jun 23, 2026

    @lrq3000

    For me it was not oh-my-openagent / oh-my-opencode as I uninstalled it months ago, the Failed to fetch error happened after sending one prompt (just "Please continue") and after a few minutes of running.

    I found out it was caused by the tools output being way too verbose and somehow overloading OpenCode core and making it crash, hence why it fails to fetch.

    Here is how my agent analyzed the issue postmortem (after I fixed it by instructing it to work around the issue instead of retrying it constantly):


    Using systematic-debugging to explain the failure mode.

    What happened:

    • I tried to follow TDD strictly by forcing the focused unit tests to execute with --rerun-tasks.
    • The command was: ./gradlew :app:testDebugConfigDebugUnitTest --rerun-tasks --tests ...
    • In this repo, --rerun-tasks is very heavy because it invalidates Gradle task outputs and forces Android/Kotlin/KSP/resource/test tasks to rebuild rather than using the incremental cache.
    • That produced a long, noisy Gradle run with a lot of output and work. In OpenCode, that appears to have overloaded or wedged the message/tool-output pipeline, causing the “fails to fetch messages” / non-responsive behavior you saw.
    • The hang was not caused by the code change itself. It was caused by repeatedly invoking the forced Gradle rerun command inside the OpenCode harness.

    How I avoided it after you warned me:

    • I stopped using --rerun-tasks immediately.
    • I switched back to normal Gradle commands:
      • ./gradlew :app:testDebugConfigDebugUnitTest --tests ...
      • ./gradlew testDebugConfigDebugUnitTest
      • ./gradlew assembleDebugConfigDebug
    • I accepted that the focused command could be reported as UP-TO-DATE, then relied on the normal full unit test task, which did execute :app:testDebugConfigDebugUnitTest once and completed successfully.
    • I also used git diff --check and diff review for lightweight validation without triggering heavy rebuild behavior.

    The practical lesson:

    • In this OpenCode environment, avoid --rerun-tasks for Android/Gradle unless explicitly necessary.
    • If we need a fresh focused test run later, a safer approach is to make a real source/test change that naturally invalidates the right task, or run the normal full test command without forcing the entire task graph.

    --

    Can you generalize the lesson? What was the core issue that needs to be avoided in the future? It seems to me that it is about avoiding overloading or wedging the message/tool-output pipeline in OpenCode with long noisy outputs?

    --

    Yes. The generalized lesson is:

    Avoid commands that can overwhelm OpenCode’s tool-output/message pipeline through long-running, noisy, or forced-rebuild behavior, especially when the same result can be obtained incrementally or with narrower verification.

    Core issue:

    • The problem was not Gradle itself, nor tests themselves.
    • The issue was repeatedly running a command pattern that produced excessive work plus excessive output inside an interactive agent harness.
    • --rerun-tasks invalidated Gradle’s incremental behavior, causing broad recompilation/resource/KSP/test work and large logs.
    • OpenCode then appeared to wedge while transporting or rendering the tool output/messages.

    Future rule:

    • Prefer incremental, bounded, low-output commands.
    • Avoid “force everything” flags such as --rerun-tasks, clean, broad rebuilds, verbose/debug logs, or full test suites unless necessary.
    • If a heavy command is necessary, run it once, with a high timeout, and avoid repeating it after interruptions.
    • Treat repeated interrupted long-output commands as a harness-risk signal, not just a build/test issue.

    Practical guidance:

    • Use focused tests first, normal incremental mode.
    • Use full tests/builds only when needed for final verification.
    • Avoid --info, --debug, --stacktrace, --scan, --rerun-tasks, and clean build unless diagnosing a specific failure.
    • Do not force fresh execution just to satisfy process purity if the harness becomes unstable.
    • If Gradle says UP-TO-DATE, use another lightweight evidence source where appropriate: source diff, test report timestamps, normal full test run, or a small targeted code/test change that naturally invalidates the task.
    • If output starts becoming huge or the tool is interrupted, stop escalating. Switch to quieter commands or ask before continuing.

    A good mental model:

    • OpenCode is not a raw terminal. It is a terminal plus message transport plus renderer.
    • The safe unit is not only “will the command finish,” but also “can the harness reliably capture and present the output.”
    • Commands that are acceptable in a local terminal can be bad in an agent harness if they flood the output channel.
  6. masterleelee commented on Jun 23, 2026

    @masterleelee
  7. shijunti19 commented on Jul 4, 2026

    @shijunti19

    Has it been fixed? It’s completely unusable.

  8. wbdb commented on Jul 16, 2026

    @wbdb
    TypeError: Failed to fetch
        at fetch (oc://renderer/assets/main-hem2imez.js:181474:45)
        at request (oc://renderer/assets/main-hem2imez.js:65797:24)
    
    Image

    No plugins installed.

  9. MikiraSora commented on Aug 20, 2026

    @MikiraSora
    Image
  10. masterleelee commented on Aug 20, 2026

    @masterleelee
  11. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

  12. masterleelee commented on Oct 11, 2026

    @masterleelee
  13. lrq3000 commented on Oct 11, 2026

    @lrq3000

    For those who are still having this issue, it's because you are using Opencode V1 or Opencode Desktop, which which necessarily uses open code v1 core and the problem is that it uh crashes when uh the the nested path is too long and and which happens very very frequently with agents uh when they when they work in work trees or when they make builds uh etc so uh because of the temporarily uh temporarily intermediate files that are generated so you should uh there is a workaround here it is :

            ```
            $env:OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER = "1" & "$env:LOCALAPPDATA\Programs\@opencode-aidesktop\OpenCode.exe"
            ```
    

    This disables the uh uh filewatcher and it's unnecessary for any uh operation. It's just for uh convenience to to see what files were modified exactly and to walk into the file tree directly from the Open Code interface. but if you just want to uh code with open code you don't need that the agents still have access to the whole uh set of functionalities and the whole file system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions