Set timout for long running commands #2784

Open
opened 2026-02-16 17:37:14 -05:00 by yindo · 15 comments
Owner

Originally created by @thekie on GitHub (Nov 11, 2025).

Originally assigned to: @rekram1-node on GitHub.

Question

Hello. When opencode runs my test suite, it encounters a timeout.

(Command timed out after 120000 ms)

Is there a way to set this timeout to a higher value or disable it?

Thank you.

Originally created by @thekie on GitHub (Nov 11, 2025). Originally assigned to: @rekram1-node on GitHub. ### Question Hello. When opencode runs my test suite, it encounters a timeout. ``` (Command timed out after 120000 ms) ``` Is there a way to set this timeout to a higher value or disable it? Thank you.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 11, 2025):

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

  • #3950: [FEATURE]: Configurable command timeout in config.json - Same request for configurable timeout settings in config.json for long-running operations like integration tests
  • #1721: bash tool often times out - Specifically about bash tool timing out on long builds/tests, requesting configurable or no timeout
  • #1065: How to control Timeouts - Question about controlling timeouts, includes discussion of the 120000ms timeout value
  • #3583: [FEATURE]: opencode run --timeout=60s - Feature request for timeout configuration in opencode run command

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

@github-actions[bot] commented on GitHub (Nov 11, 2025): This issue might be a duplicate of existing issues. Please check: - #3950: [FEATURE]: Configurable command timeout in config.json - Same request for configurable timeout settings in config.json for long-running operations like integration tests - #1721: bash tool often times out - Specifically about bash tool timing out on long builds/tests, requesting configurable or no timeout - #1065: How to control Timeouts - Question about controlling timeouts, includes discussion of the 120000ms timeout value - #3583: [FEATURE]: opencode run --timeout=60s - Feature request for timeout configuration in opencode run command Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Nov 11, 2025):

@thekie the timeout defaults to 1 minute, the model is allowed to set a timeout when it calls the bash tool up to 10 min, if you want the default to be configurable we can do that too

@rekram1-node commented on GitHub (Nov 11, 2025): @thekie the timeout defaults to 1 minute, the model is allowed to set a timeout when it calls the bash tool up to 10 min, if you want the default to be configurable we can do that too
Author
Owner

@rekram1-node commented on GitHub (Nov 11, 2025):

if it is a long running task u can just tell it to set a higher timeout, or u can put that in your AGENTS.md

@rekram1-node commented on GitHub (Nov 11, 2025): if it is a long running task u can just tell it to set a higher timeout, or u can put that in your AGENTS.md
Author
Owner

@easychen commented on GitHub (Nov 12, 2025):

When using opencode via run, there seems to be a 5-minute time limit. An error will occur when the runtime exceeds 5 minutes. Is there a way to modify this setting?

Error: Unexpected error, check log file at /root/.local/share/opencode/log/2025-11-12T162411.log for more details

DOMException {
  stack: "",
  code: 23,
  name: "TimeoutError",
  message: "The operation timed out.",
  INDEX_SIZE_ERR: 1,
  DOMSTRING_SIZE_ERR: 2,
  HIERARCHY_REQUEST_ERR: 3,
  WRONG_DOCUMENT_ERR: 4,
  INVALID_CHARACTER_ERR: 5,
  NO_DATA_ALLOWED_ERR: 6,
  NO_MODIFICATION_ALLOWED_ERR: 7,
  NOT_FOUND_ERR: 8,
  NOT_SUPPORTED_ERR: 9,
  INUSE_ATTRIBUTE_ERR: 10,
  INVALID_STATE_ERR: 11,
  SYNTAX_ERR: 12,
  INVALID_MODIFICATION_ERR: 13,
  NAMESPACE_ERR: 14,
  INVALID_ACCESS_ERR: 15,
  VALIDATION_ERR: 16,
  TYPE_MISMATCH_ERR: 17,
  SECURITY_ERR: 18,
  NETWORK_ERR: 19,
  ABORT_ERR: 20,
  URL_MISMATCH_ERR: 21,
  QUOTA_EXCEEDED_ERR: 22,
  TIMEOUT_ERR: 23,
  INVALID_NODE_TYPE_ERR: 24,
  DATA_CLONE_ERR: 25,
  toString: [Function: toString],
}

I set the timeout for the provider, but it doesn't seem to be working.

"provider": {
        "zhipuai-coding-plan": {
            "options": {
                "apiKey": "{env:AI_API_KEY}",
                "timeout": 600000
            }
        }
}
@easychen commented on GitHub (Nov 12, 2025): When using opencode via run, there seems to be a 5-minute time limit. An error will occur when the runtime exceeds 5 minutes. Is there a way to modify this setting? ``` Error: Unexpected error, check log file at /root/.local/share/opencode/log/2025-11-12T162411.log for more details DOMException { stack: "", code: 23, name: "TimeoutError", message: "The operation timed out.", INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25, toString: [Function: toString], } ``` I set the timeout for the provider, but it doesn't seem to be working. ```json "provider": { "zhipuai-coding-plan": { "options": { "apiKey": "{env:AI_API_KEY}", "timeout": 600000 } } } ```
Author
Owner

@rekram1-node commented on GitHub (Nov 12, 2025):

i think ik what causes that, it's only in opencode run right

@rekram1-node commented on GitHub (Nov 12, 2025): i think ik what causes that, it's only in opencode run right
Author
Owner

@easychen commented on GitHub (Nov 12, 2025):

i think ik what causes that, it's only in opencode run right

Yes, it only occurs under run and can exceed 5 minutes in the TUI.

@easychen commented on GitHub (Nov 12, 2025): > i think ik what causes that, it's only in opencode run right Yes, it only occurs under run and can exceed 5 minutes in the TUI.
Author
Owner

@rekram1-node commented on GitHub (Nov 12, 2025):

ill fix it soon, prolly tonight

@rekram1-node commented on GitHub (Nov 12, 2025): ill fix it soon, prolly tonight
Author
Owner

@rekram1-node commented on GitHub (Nov 13, 2025):

Fixed in next release @easychen

@rekram1-node commented on GitHub (Nov 13, 2025): Fixed in next release @easychen
Author
Owner

@easychen commented on GitHub (Nov 13, 2025):

Fixed in next release @easychen

I tested version 1.0.65 and it works perfectly. Thank you for the efficient response.

@easychen commented on GitHub (Nov 13, 2025): > Fixed in next release [@easychen](https://github.com/easychen) I tested version 1.0.65 and it works perfectly. Thank you for the efficient response.
Author
Owner

@Oneton429 commented on GitHub (Nov 14, 2025):

Fixed in next release @easychen

I tested version 1.0.65 and it works perfectly. Thank you for the efficient response.

Sorry to bother you, but could you please tell me how to change or set the timeout?

My opencode v1.0.65 (Command timed out after 60000 ms) when building a Dockerfile

@Oneton429 commented on GitHub (Nov 14, 2025): > > Fixed in next release [@easychen](https://github.com/easychen) > > I tested version 1.0.65 and it works perfectly. Thank you for the efficient response. Sorry to bother you, but could you please tell me how to change or set the timeout? My opencode v1.0.65 `(Command timed out after 60000 ms)` when building a Dockerfile
Author
Owner

@easychen commented on GitHub (Nov 14, 2025):

Fixed in next release @easychen

I tested version 1.0.65 and it works perfectly. Thank you for the efficient response.

Sorry to bother you, but could you please tell me how to change or set the timeout?

My opencode v1.0.65 (Command timed out after 60000 ms) when building a Dockerfile

This seems to be related to the bash timeout limit. Perhaps you can specify in the prompt to set the timeout to the maximum value when calling bash tools to build Docker.

https://github.com/sst/opencode/blob/5e886c35d59a31da5268a8442ff335acef3604e0/packages/opencode/src/tool/bash.ts#L15

@easychen commented on GitHub (Nov 14, 2025): > > > Fixed in next release [@easychen](https://github.com/easychen) > > > > > > I tested version 1.0.65 and it works perfectly. Thank you for the efficient response. > > Sorry to bother you, but could you please tell me how to change or set the timeout? > > My opencode v1.0.65 `(Command timed out after 60000 ms)` when building a Dockerfile This seems to be related to the bash timeout limit. Perhaps you can specify in the prompt to set the timeout to the maximum value when calling bash tools to build Docker. https://github.com/sst/opencode/blob/5e886c35d59a31da5268a8442ff335acef3604e0/packages/opencode/src/tool/bash.ts#L15
Author
Owner

@PSU3D0 commented on GitHub (Dec 31, 2025):

Tool specific timeout? Some tools are HITL and might be multi-day.

@PSU3D0 commented on GitHub (Dec 31, 2025): Tool specific timeout? Some tools are HITL and might be multi-day.
Author
Owner

@shiny commented on GitHub (Jan 20, 2026):

encounter the same issue when deploying to remote server

@shiny commented on GitHub (Jan 20, 2026): encounter the same issue when deploying to remote server
Author
Owner

@crazythinking commented on GitHub (Jan 30, 2026):

I had already requested a timeout of 10 minutes in the prompt, but it still exceeded the time limit after 120 seconds

Image
@crazythinking commented on GitHub (Jan 30, 2026): I had already requested a timeout of 10 minutes in the prompt, but it still exceeded the time limit after 120 seconds <img width="1572" height="642" alt="Image" src="https://github.com/user-attachments/assets/f20e9e4c-41c2-4073-a049-c824cbb8934e" />
Author
Owner

@stergiosba commented on GitHub (Feb 6, 2026):

If you are using tmux you can just ask the agent to start a new tmux process in the background, and then if you want you can attach to it. I just did a long training session ~8 hours and I wanted to check once or twice without a problem.

edit> The agent was able to see what was happening in the other tmux session and maintained context (at least for my use case) successfully.

@stergiosba commented on GitHub (Feb 6, 2026): If you are using tmux you can just ask the agent to start a new tmux process in the background, and then if you want you can attach to it. I just did a long training session ~8 hours and I wanted to check once or twice without a problem. edit> The agent was able to see what was happening in the other tmux session and maintained context (at least for my use case) successfully.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2784