{"record":{"id":"ac0e1be61e48c385","repo":"chenhg5/cc-connect","slug":"acp-write-s-w","errorCode":null,"errorMessage":"acp: write %s: %w","messagePattern":"acp: write (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/acp/rpc.go","lineNumber":189,"sourceCode":"func (t *transport) call(ctx context.Context, method string, params any) (json.RawMessage, error) {\n\tid := t.nextID.Add(1)\n\tkey := fmt.Sprintf(\"%d\", id)\n\tch := make(chan rpcOutcome, 1)\n\tt.pendingMu.Lock()\n\tt.pending[key] = ch\n\tt.pendingMu.Unlock()\n\n\treq := map[string]any{\n\t\t\"jsonrpc\": \"2.0\",\n\t\t\"id\":      id,\n\t\t\"method\":  method,\n\t\t\"params\":  params,\n\t}\n\tif err := t.writeJSON(req); err != nil {\n\t\tt.pendingMu.Lock()\n\t\tdelete(t.pending, key)\n\t\tt.pendingMu.Unlock()\n\t\treturn nil, fmt.Errorf(\"acp: write %s: %w\", method, err)\n\t}\n\tselect {\n\tcase <-ctx.Done():\n\t\tt.pendingMu.Lock()\n\t\tdelete(t.pending, key)\n\t\tt.pendingMu.Unlock()\n\t\treturn nil, ctx.Err()\n\tcase out := <-ch:\n\t\tif out.err != nil {\n\t\t\treturn nil, out.err\n\t\t}\n\t\treturn out.result, nil\n\t}\n}\n\nfunc (t *transport) sendNotification(method string, params any) error {\n\treturn t.writeJSON(map[string]any{\n\t\t\"jsonrpc\": \"2.0\",","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/acp/rpc.go#L171-L207","documentation":"Raised by transport.call when serializing/writing a JSON-RPC request for the named method to the agent's stdin fails. It fires when the process stdin pipe is broken (agent exited) or the write is rejected; the pending entry is cleaned up and the whole call aborts.","triggerScenarios":"Thrown at agent/acp/rpc.go:189 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check whether the agent process is still alive before sending (session closed errors usually accompany this)","Restart the session — a broken stdin pipe is not recoverable on the same transport","Look for earlier errors explaining why the agent exited"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}