Skip to content

stop: cancel task, id_task = 2 Codex timeout overwrite

Quick fix

Increase startup_timeout_sec, and save the MCP configuration once more after it is overwritten a second time.

Error output
2.04.274.375 W srv          stop: cancel task, id_task = 2

Connecting a local llama-server to Codex through cc-switch, the first session takes a long time to process the prompt. The stop: cancel task, id_task = 2 line in the log relates to the Codex startup_timeout_sec being too small; increasing it prevents the task being cancelled.

Users also observe ~/.codex/config.toml being overwritten once by the cc-switch MCP server configuration when ChatGPT/Codex starts, and again when the first Codex session begins, resetting a startup_timeout_sec they raised by hand or in the MCP configuration. Maintainers did not confirm in the issue where the data for the second overwrite comes from.

  1. Increase startup_timeout_sec from 120 to something larger, 1200 for instance, so the local model startup / first request does not time out.

    C:\Users\user\.codex\config.toml
    startup_timeout_sec = 1200
  2. If the configuration is written by the cc-switch MCP server configuration, change startup_timeout_sec there too.

  3. If config.toml is overwritten back to startup_timeout_sec = 120 after the first Codex session begins, change and save the MCP config file again. Users report later sessions are not overwritten and the error does not return.

ToolCodex
VersionUnknown
PlatformsWindowsmacOS
Why is config.toml overwritten twice?
The issue observes ChatGPT/Codex overwriting it once with the cc-switch MCP server config file at startup, and again when the first session begins. The source of the data for the second overwrite was not confirmed.
Why does the first session still fail after I edit the MCP config file?
config.toml is overwritten again when the first session begins, and startup_timeout_sec = 1200 may be reset to startup_timeout_sec = 120. After saving the MCP configuration again, users report later sessions are no longer overwritten.
Is stop: cancel task, id_task = 2 necessarily caused by cc-switch?
That log line comes from llama-server; the user in the issue associated it with the Codex startup_timeout_sec timeout. Raising the timeout avoids the problem, but maintainers never confirmed a final root cause in the issue.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.