Skip to content

Print statement was running in the shell until the tokens got exhausted #53910

Description

@prawinextrive

Description

Pretty much the title. I dont know why but this had happened twice before as well. Please check the attached screenshot for more details.

Image

Plugins

No response

OpenCode version

v1.18.35

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

MacOS Golden Gate 27.0.1 (26A434)

Terminal

No response

Activity

  1. opencode-agent commented on Oct 8, 2026

    @opencode-agent
    Contributor

    Thanks for reporting this, @prawinextrive! To look into it, we need a few more details:

    • OpenCode version: the output of opencode --version
    • Provider and model you were using when this happened
    • Operating system, how you installed OpenCode, and your terminal
    • What you asked for: the prompt or task that led to it, if you can share it
    • What exactly repeated: did OpenCode run a shell command (bash tool) that never finished and kept printing output, or did the model keep writing or calling the same print statement over and over? If you can, a share link (/share) or the session export would help a lot.

    You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know when you're done.

    These existing issues look related, ordered from most to least likely. Please check whether one of them already covers your problem:

  2. prawinextrive commented on Oct 8, 2026

    @prawinextrive
    Author

    Thanks for reporting this, @prawinextrive! To look into it, we need a few more details:

    • OpenCode version: the output of opencode --version
    • Provider and model you were using when this happened
    • Operating system, how you installed OpenCode, and your terminal
    • What you asked for: the prompt or task that led to it, if you can share it
    • What exactly repeated: did OpenCode run a shell command (bash tool) that never finished and kept printing output, or did the model keep writing or calling the same print statement over and over? If you can, a share link (/share) or the session export would help a lot.

    You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know when you're done.

    These existing issues look related, ordered from most to least likely. Please check whether one of them already covers your problem:

    • OpenCode version: v1.18.35 (latest version)
    • Provider and model Openocde/Big Pickle
    • Operating system, Installed it in my mac as a desktop app.
    • What you asked for: "fix_mismatched_keys and normalise_artwork_values are changed to lite now. where exactly we can change the models to lite let me know those places first. give me the function name alone. i will check and let you know." This was the exact prompt where I asked opencode to change few LLM models in code.
    • What exactly repeated: In shell, I could see that print statement was running continously for an hour. This is the command:
      """$ python3 -c "print('ok')" 2>&1 | tail -1
      ok
      """
  3. opencode-agent commented on Oct 8, 2026

    @opencode-agent
    Contributor

    Thanks for the details, @prawinextrive, that makes it much clearer.

    From your description, the shell wasn't stuck. The model (Big Pickle) kept calling the same tool over and over: it ran python3 -c "print('ok')" 2>&1 | tail -1 again and again, and each run finished straight away. So this is the model getting stuck in a loop of identical tool calls, which is the same pattern as these existing reports (ordered by likelihood):

    You're on v1.18.35, which is OpenCode v1. v1 now only gets fixes for critical bugs (data loss, security problems, or breakage with no workaround). You can stop a looping session yourself to end it, so this is unlikely to be fixed in v1. If you can, please try OpenCode v2 (the @opencode/cli package, opencode command). If it also happens there, or you think this should count as critical, reply here and we'll take another look. It may also help to try a different model for this kind of task, since these loops depend a lot on the model.

  4. prawinextrive commented on Oct 8, 2026

    @prawinextrive
    Author

    Thanks for the details, @prawinextrive, that makes it much clearer.

    From your description, the shell wasn't stuck. The model (Big Pickle) kept calling the same tool over and over: it ran python3 -c "print('ok')" 2>&1 | tail -1 again and again, and each run finished straight away. So this is the model getting stuck in a loop of identical tool calls, which is the same pattern as these existing reports (ordered by likelihood):

    You're on v1.18.35, which is OpenCode v1. v1 now only gets fixes for critical bugs (data loss, security problems, or breakage with no workaround). You can stop a looping session yourself to end it, so this is unlikely to be fixed in v1. If you can, please try OpenCode v2 (the @opencode/cli package, opencode command). If it also happens there, or you think this should count as critical, reply here and we'll take another look. It may also help to try a different model for this kind of task, since these loops depend a lot on the model.

    The thing is I tried to stop it three times but the same issue happened 4th time as well which exhausted my token usage. I don't know what you will consider as an emergency or an issue. It would be better if some human replied to my queries rather than a clanker bot.

  5. opencode-agent commented on Oct 8, 2026

    @opencode-agent
    Contributor

    Sorry about the lost tokens, @prawinextrive, that's frustrating.

    Stopping the session does end each loop, but it starts again because the same model (Big Pickle) gets stuck the same way on that prompt when you rerun it. Big Pickle has been reported looping like this before (#26220, #42956), and #45442 covers OpenCode having no protection against repeated identical tool calls.

    Some things that should help right now:

    • Switch to a different model for this task. These loops depend heavily on the model, so this is the most reliable workaround.
    • Start a fresh session instead of continuing the one that looped. Once the repeated tool calls are in the conversation history, the model is more likely to keep copying them.
    • Upgrade to OpenCode v2 (the @opencode/cli package, opencode command). That's where development happens now.

    Since this is on v1 (1.18.35) and has workarounds, it's unlikely to be fixed there. If you see the same looping on v2, please reply here with the version and model and we'll look at it again.

  6. opencode-agent commented on Oct 9, 2026

    @opencode-agent
    Contributor

    Closing this as not planned. It's on OpenCode v1 (1.18.35), which now only gets fixes for critical bugs. The repeated print('ok') calls came from the model (Big Pickle) getting stuck in a tool-call loop, and switching models or starting a fresh session works around it.

    The general looping problem is tracked in #45442, with related Big Pickle reports in #26220 and #42956. If you see the same thing on OpenCode v2 (@opencode/cli), please open a new issue or comment here with the version and model, and we'll take another look. Thanks for reporting it, @prawinextrive.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions