{"record":{"id":"3cd7f1d61f41d22a","repo":"chenhg5/cc-connect","slug":"acp-probe-parse-initialize-w","errorCode":null,"errorMessage":"acp: probe parse initialize: %w","messagePattern":"acp: probe parse initialize: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/acp/list_sessions.go","lineNumber":143,"sourceCode":"}\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)\n\tif err != nil {\n\t\tif rpcErr, ok := err.(*rpcErrPayload); ok {\n\t\t\tif rpcErr.Code == -32601 || rpcErr.Code == -32600 {\n\t\t\t\treturn nil, nil","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/acp/list_sessions.go#L125-L161","documentation":"Raised in probeInitialize when the 'initialize' RPC succeeded at the transport level but the returned payload could not be unmarshalled into the expected acpInitializeResult shape. It fires when the agent answers with malformed or non-conforming JSON, indicating a protocol mismatch.","triggerScenarios":"Thrown at agent/acp/list_sessions.go:143 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the agent implements the ACP initialize response schema the bridge expects","Update cc-connect to a version matching the agent's ACP protocol version","Capture the raw initialize response and compare it against the expected structure"],"exampleFix":null,"handlingStrategy":"type-guard","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"}