{"record":{"id":"1d60d56d5e5bc25a","repo":"micro/go-micro","slug":"a2a-tasks-resubscribe-s-d","errorCode":null,"errorMessage":"a2a tasks/resubscribe: %s (%d)","messagePattern":"a2a tasks/resubscribe: (.+?) \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gateway/a2a/client.go","lineNumber":192,"sourceCode":"\t\tfor scanner.Scan() {\n\t\t\tline := scanner.Text()\n\t\t\tif !strings.HasPrefix(line, \"data:\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpayload := strings.TrimSpace(strings.TrimPrefix(line, \"data:\"))\n\t\t\tif payload == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar out struct {\n\t\t\t\tResult Task      `json:\"result\"`\n\t\t\t\tError  *rpcError `json:\"error\"`\n\t\t\t}\n\t\t\tif err := json.Unmarshal([]byte(payload), &out); err != nil {\n\t\t\t\terrs <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif out.Error != nil {\n\t\t\t\terrs <- fmt.Errorf(\"a2a tasks/resubscribe: %s (%d)\", out.Error.Message, out.Error.Code)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\terrs <- ctx.Err()\n\t\t\t\treturn\n\t\t\tcase tasks <- out.Result:\n\t\t\t}\n\t\t\tif terminal(out.Result.Status.State) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif err := scanner.Err(); err != nil {\n\t\t\terrs <- err\n\t\t}\n\t}()\n\treturn tasks, errs\n}","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/gateway/a2a/client.go#L174-L210","documentation":"Inside the tasks/resubscribe SSE stream, each data frame is a JSON-RPC-style envelope that can carry an error object. The library surfaces out.Error (message and code) through this error when the server reports an application-level error on the stream, even though the HTTP status was 200. The stream is terminated after emitting it.","triggerScenarios":"The remote agent pushes a JSON-RPC error frame (e.g. code -32602 invalid params, -32001 task not found, auth error) as the first event of the resubscribe stream, typically because the task ID is unknown or the request payload was rejected.","commonSituations":"Resubscribing to a task the agent no longer tracks; sending a resubscribe request missing required fields after an API change; agent-side authorization revocation mid-session.","solutions":["Check the JSON-RPC code in the error: 'task not found' means start over with SendMessage; auth codes mean refresh credentials.","Validate the resubscribe request payload (task ID, context ID) against the current A2A spec version the agent implements.","Fall back to polling tasks/get for final state if the stream cannot be re-established.","Log the server message verbatim; it usually names the exact invalid field or task."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"select {\ncase err := <-errs:\n\tif strings.HasPrefix(err.Error(), \"a2a tasks/resubscribe:\") {\n\t\tvar rpcErr struct{ Message string; Code int }\n\t\t// extract message/code; route on code (-32602, task-not-found, auth)\n\t}\ncase ev := <-events:\n}","preventionTips":["Log the JSON-RPC code and message verbatim for triage","Send only spec-compliant task/context IDs in resubscribe requests","Keep client and agent A2A versions aligned","Fall back to tasks/get polling when the stream errors"],"tags":["a2a","json-rpc","streaming","sse"],"backgroundTag":"json-rpc-error-response","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}