{"record":{"id":"60cbb1233fa36c9c","repo":"chenhg5/cc-connect","slug":"s-timed-out","errorCode":null,"errorMessage":"%s timed out","messagePattern":"(.+?) timed out","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/codex/appserver_session.go","lineNumber":1633,"sourceCode":"\t\t\"jsonrpc\": \"2.0\",\n\t\t\"id\":      id,\n\t\t\"method\":  method,\n\t\t\"params\":  params,\n\t}\n\n\tdeadline := time.Now().Add(timeout)\n\tif err := s.writeJSONWithTimeout(method, payload, timeout); err != nil {\n\t\ts.pendingMu.Lock()\n\t\tdelete(s.pending, id)\n\t\ts.pendingMu.Unlock()\n\t\treturn err\n\t}\n\tremaining := time.Until(deadline)\n\tif remaining <= 0 {\n\t\ts.pendingMu.Lock()\n\t\tdelete(s.pending, id)\n\t\ts.pendingMu.Unlock()\n\t\treturn fmt.Errorf(\"%s timed out\", method)\n\t}\n\n\ttimer := time.NewTimer(remaining)\n\tdefer timer.Stop()\n\tctxDone := s.contextDone()\n\tselect {\n\tcase resp := <-ch:\n\t\tif resp.Error != nil {\n\t\t\treturn fmt.Errorf(\"%s\", strings.TrimSpace(resp.Error.Message))\n\t\t}\n\t\tif out != nil {\n\t\t\tif err := json.Unmarshal(resp.Result, out); err != nil {\n\t\t\t\treturn fmt.Errorf(\"decode %s response: %w\", method, err)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\tcase <-ctxDone:\n\t\treturn s.contextErr()","sourceCodeStart":1615,"sourceCodeEnd":1651,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/codex/appserver_session.go#L1615-L1651","documentation":"Returned by `requestWithTimeout` when, after the JSON-RPC write completes, the total deadline for the request has already elapsed (remaining <= 0), so the adapter abandons the call before waiting for a response. The message is `<method> timed out`, e.g. `thread/start timed out`. It indicates the app-server took longer than `appServerRequestTimeout` even to accept the write.","triggerScenarios":"Calling any request method (thread/start, turn/create, etc.) where `writeJSONWithTimeout` consumed the entire timeout budget (e.g. blocked stdin pipe), leaving `time.Until(deadline)` <= 0 before the select on the response channel begins.","commonSituations":"Codex app-server process is hung or not reading stdin; slow machine under heavy load; disk/full pipe blocking the write; oversized payload serialization; container CPU throttling.","solutions":["Check whether the codex app-server process is alive and responsive (`ps aux | grep codex`).","Restart the codex process / recreate the session — a hung child usually stays hung.","Increase `appServerRequestTimeout` if legitimate operations are slow in your environment.","Check system resources (CPU, load) on the host running codex.","Verify the codex binary version starts correctly standalone before cc-connect launches it."],"exampleFix":"// before: single short timeout on a slow machine\ns.request(method, params, out)\n\n// after: use requestWithTimeout with a larger budget\nerr := s.requestWithTimeout(method, params, out, 60*time.Second)","handlingStrategy":"retry","validationCode":"// before calling: ensure the codex process is responsive\nif !sess.Alive() {\n    return fmt.Errorf(\"codex session dead; restart before requesting\")\n}","typeGuard":null,"tryCatchPattern":"err := sess.requestWithTimeout(method, params, out, 60*time.Second)\nif err != nil && strings.HasSuffix(err.Error(), \"timed out\") {\n    // rebuild session once, then retry\n    sess, err = agent.StartSession(ctx, opts)\n    if err == nil {\n        err = sess.requestWithTimeout(method, params, out, 60*time.Second)\n    }\n}","preventionTips":["Size the timeout for cold starts on slow hosts.","Health-check the codex process before requests.","Avoid overloading a single app-server with parallel turns.","Restart hung sessions proactively."],"tags":["codex","timeout","json-rpc","ipc"],"backgroundTag":"request-timeout","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}