Skip to content

Getting stuck at 'Running commands' > Shell > undefined #5662

Closed as not planned

Description

@badrul
Image

Application hangs indefinitely at the shell execution stage with an undefined reference.

Environment:

OS: Windows 10
OpenCode Version: 1.0.164
Console: cmder

Activity

  1. github-actions commented on Dec 17, 2025

    @github-actions
    Contributor

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

    Feel free to ignore if none of these address your specific case.

  2. added
    webRelates to opencode on web / desktop
    bugSomething isn't working
    on Dec 17, 2025
  3. rekram1-node commented on Dec 17, 2025

    @rekram1-node
    Collaborator

    /oc any idea what could be causing this? look at what shell the packages/desktop uses for the pty ajd figure out what could result in this

  4. opencode-agent commented on Dec 17, 2025

    @opencode-agent
    Contributor

    Now I have a complete picture. Let me summarize the findings:


    Analysis: "Running commands > Shell > undefined" Issue

    Root Cause

    The issue is not directly related to the PTY shell detection in the desktop package. Instead, this appears to be related to how the bash tool renders in the UI when props.input.description is undefined.

    Looking at the UI component in packages/ui/src/components/message-part.tsx lines 426-431:

    <BasicTool
      icon="console"
      trigger={{
        title: "Shell",
        subtitle: props.input.description,
      }}
    >

    The subtitle is set to props.input.description. When the LLM calls the bash tool without providing the description parameter, this value is undefined.

    In basic-tool.tsx line 51-60, there's a <Show when={trigger().subtitle}> check that should hide it when falsy. However, if the description is the literal string "undefined" (which can happen during JSON serialization/deserialization), it would still display.

    Potential Causes

    1. The model is sending the literal string "undefined" as the description parameter instead of omitting it or sending null.

    2. JSON serialization issue: When tool inputs are serialized/deserialized, undefined values might be converted to the string "undefined".

    3. Windows-specific issue: On Windows with cmder, there may be something unusual about how the environment or tool inputs are being processed.

    Shell Detection on Windows

    The shell detection in packages/opencode/src/shell/shell.ts is actually robust and should never return undefined:

    function fallback() {
      if (process.platform === "win32") {
        if (Flag.OPENCODE_GIT_BASH_PATH) return Flag.OPENCODE_GIT_BASH_PATH
        const git = Bun.which("git")
        if (git) {
          const bash = path.join(git, "..", "..", "bin", "bash.exe")
          if (Bun.file(bash).size) return bash  // ⚠️ Potential issue here
        }
        return process.env.COMSPEC || "cmd.exe"  // Always has fallback
      }
      // ...
    }

    One edge case: Bun.file(bash).size is async but is being used synchronously. This could return a Promise object that's truthy but not a valid shell path. However, this wouldn't produce the string "undefined".

    Recommendation

    The issue is most likely that the bash tool's description parameter is being displayed as the literal string "undefined". The fix would be to add defensive handling in the UI:

    subtitle: props.input.description || undefined,

    This ensures that falsy strings like empty string or the string "undefined" aren't displayed.

    New%20session%20-%202025-12-17T02%3A14%3A08.920Z
    opencode session  |  github run

  5. badrul commented on Dec 17, 2025

    @badrul
    Author

    running with --print-logs, i get these:

    ERROR 2025-12-17T02:09:45 +151ms service=acp-command promise={} reason=NotFoundError Unhandled rejection
    ERROR 2025-12-17T02:09:45 +1ms service=default e=NotFoundError rejection
    INFO 2025-12-17T02:09:46 +461ms service=bus type=session.updated publishing
    INFO 2025-12-17T02:09:46 +2ms service=bus type=session.diff publishing
    ERROR 2025-12-17T02:09:47 +1013ms service=acp-command promise={} reason=NotFoundError Unhandled rejection
    ERROR 2025-12-17T02:09:47 +0ms service=default e=NotFoundError rejection
    INFO 2025-12-17T02:09:53 +6233ms service=session.summary title=Checking Current Status title
    INFO 2025-12-17T02:09:53 +1ms service=bus type=message.updated publishing
    ERROR 2025-12-17T02:09:54 +1005ms service=acp-command promise={} reason=NotFoundError Unhandled rejection
    ERROR 2025-12-17T02:09:54 +0ms service=default e=NotFoundError rejection
    INFO 2025-12-17T02:10:02 +8317ms service=snapshot hash=3745f8b408349c5a1ab621d58ef9f5f0642b16c1
    cwd=C:[project path] git=C:[user path].local\share\opencode\snapshot\c5b6b9820d4608b7746befe7c7b05d559b3e8f05 tracking
    INFO 2025-12-17T02:10:02 +3ms service=bus type=message.part.updated publishing
    INFO 2025-12-17T02:10:02 +5ms service=bus type=message.part.updated publishing
    ERROR 2025-12-17T02:10:03 +1002ms service=acp-command promise={} reason=NotFoundError Unhandled rejection
    ERROR 2025-12-17T02:10:03 +0ms service=default e=NotFoundError rejection
    INFO 2025-12-17T02:10:04 +978ms service=bus type=message.part.updated publishing
    INFO 2025-12-17T02:10:05 +331ms service=bus type=message.part.updated publishing
    INFO 2025-12-17T02:10:05 +8ms service=bus type=message.part.updated publishing
    INFO 2025-12-17T02:10:05 +29ms service=permission sessionID=ses_4d84b8842ffedJ5Fi5cf25T3wS messageID=msg_b2a120e73002idlMUkP93KoBoH toolCallID=call_d4906847513741d9b6c3011e pattern=["git status *"] asking
    INFO 2025-12-17T02:10:05 +1ms service=bus type=permission.updated publishing
    ERROR 2025-12-17T02:10:05 +646ms service=acp-command promise={} reason=NotFoundError Unhandled rejection
    ERROR 2025-12-17T02:10:05 +1ms service=default e=NotFoundError rejection
    INFO 2025-12-17T02:10:05 +7ms service=bus type=message.part.updated publishing
    INFO 2025-12-17T02:10:05 +2ms service=bus type=message.part.updated publishing
    ERROR 2025-12-17T02:10:06 +1005ms service=acp-command promise={} reason=NotFoundError Unhandled rejection
    ERROR 2025-12-17T02:10:06 +1ms service=default e=NotFoundError rejection

  6. rekram1-node commented on Dec 17, 2025

    @rekram1-node
    Collaborator

    hm need to figure out that not found error looks like cause

  7. wolfie82 commented on Dec 23, 2025

    @wolfie82
    Contributor

    I took the desktop app for a spin and ran into this error as well. Agent runs shell command that presents undefined then just continues to spin indefinitely.

  8. rekram1-node commented on Dec 23, 2025

    @rekram1-node
    Collaborator

    can u share a session w me?

  9. wolfie82 commented on Dec 23, 2025

    @wolfie82
    Contributor

    I'm trying to replicate it, but I think it could be from continuing a session that was first started via cli, then opening it in desktop. Off 1.0.193, running a session from start on desktop, I haven't been able to make it fail.

  10. wolfie82 commented on Dec 23, 2025

    @wolfie82
    Contributor

    I'm trying to replicate it, but I think it could be from continuing a session that was first started via cli, then opening it in desktop. Off 1.0.193, running a session from start on desktop, I haven't been able to make it fail.

    Spoke too soon. Unfortunately, I can't share this particular session.

  11. aldaw commented on Dec 24, 2025

    @aldaw

    I have the same Problem, it was a newly fresh created session in open code.
    The problem accrued after the first update today to V1.0.195 (MacOS).
    Not my biggest want but it is no big deal for me to share the session with a developer.

  12. aldaw commented on Dec 25, 2025

    @aldaw

    It is strange, even when I make a new session inside the project the error persists.
    Only when I make a new project it behaves normal again.
    @rekram1-node how can I send you the Session Link? The Discord Link in your bio is expired.
    Or should I send to @adamdotdevin since he is assigned now?

  13. aldaw commented on Dec 25, 2025

    @aldaw

    Anyone encountered any kind of work around?

    I am kinda stuck with my work, I already got used to OpenCode with in just a day, that I rather wait until it is fixed.
    But I can't also wait weeks or indefinitely :P Thanks by the way for all contributors initiators, for every invested second!

  14. github-actions commented on Mar 25, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  15. johnsonsleo commented on Apr 4, 2026

    @johnsonsleo

    same issue

  16. removed
    bugSomething isn't working
    webRelates to opencode on web / desktop
    on May 3, 2026
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