{"record":{"id":"a7f2792798c39bb6","repo":"chenhg5/cc-connect","slug":"acp-probe-initialize-w","errorCode":null,"errorMessage":"acp: probe initialize: %w","messagePattern":"acp: probe initialize: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/acp/list_sessions.go","lineNumber":139,"sourceCode":"\t\t\t<-done\n\t\t}\n\t}\n\treturn tr, &stderrBuf, teardown, nil\n}\n\n// probeInitialize performs the ACP handshake on an already-spawned\n// transport and returns the parsed initialize result.\nfunc probeInitialize(ctx context.Context, tr *transport) (*acpInitializeResult, error) {\n\traw, err := tr.call(ctx, \"initialize\", map[string]any{\n\t\t\"protocolVersion\": 1,\n\t\t\"clientCapabilities\": map[string]any{\n\t\t\t\"fs\":       map[string]any{\"readTextFile\": false, \"writeTextFile\": false},\n\t\t\t\"terminal\": false,\n\t\t},\n\t\t\"clientInfo\": map[string]any{\"name\": \"cc-connect\", \"version\": \"1.0.0\"},\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"acp: probe initialize: %w\", err)\n\t}\n\tvar res acpInitializeResult\n\tif err := json.Unmarshal(raw, &res); err != nil {\n\t\treturn nil, fmt.Errorf(\"acp: probe parse initialize: %w\", err)\n\t}\n\treturn &res, nil\n}\n\n// probeListSessions runs `session/list` on the given transport.\n// Returns (nil, nil) if the agent refuses the call with\n// method-not-found / invalid-request — callers interpret that as\n// \"unsupported\" rather than \"real error\".\nfunc probeListSessions(ctx context.Context, tr *transport, cwdFilter string) ([]acpSessionListEntry, error) {\n\tparams := map[string]any{}\n\tif cwdFilter != \"\" {\n\t\tparams[\"cwd\"] = cwdFilter\n\t}\n\traw, err := tr.call(ctx, \"session/list\", params)","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/acp/list_sessions.go#L121-L157","documentation":"Wraps a failed JSON-RPC 'initialize' call during the ACP probe handshake in agent/acp/list_sessions.go. It fires when the spawned agent binary does not answer the initialize request within the probe timeout, exits early, or returns a protocol/transport error — meaning the CLI is not a working ACP agent.","triggerScenarios":"Thrown at agent/acp/list_sessions.go:139 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the configured agent binary supports the ACP protocol and the expected protocol version","Run the agent CLI manually to confirm it starts and prints newline-delimited JSON-RPC on stdout","Check the wrapped error for timeout vs process-exit causes; increase the probe timeout if the agent is slow to boot","Inspect the appended stderr output (if any) for the agent's own startup failure message"],"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-14T05:17:10.506Z"}