micro/go-micro · error
a2a tasks/resubscribe: %s (%d)
Error message
a2a tasks/resubscribe: %s (%d)
What it means
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.
Source
Thrown at gateway/a2a/client.go:192
for scanner.Scan() {
line := scanner.Text()
if !strings.HasPrefix(line, "data:") {
continue
}
payload := strings.TrimSpace(strings.TrimPrefix(line, "data:"))
if payload == "" {
continue
}
var out struct {
Result Task `json:"result"`
Error *rpcError `json:"error"`
}
if err := json.Unmarshal([]byte(payload), &out); err != nil {
errs <- err
return
}
if out.Error != nil {
errs <- fmt.Errorf("a2a tasks/resubscribe: %s (%d)", out.Error.Message, out.Error.Code)
return
}
select {
case <-ctx.Done():
errs <- ctx.Err()
return
case tasks <- out.Result:
}
if terminal(out.Result.Status.State) {
return
}
}
if err := scanner.Err(); err != nil {
errs <- err
}
}()
return tasks, errs
}View on GitHub (pinned to 24529f1404)
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.
Defensive patterns
Strategy: try-catch
Try / catch
select {
case err := <-errs:
if strings.HasPrefix(err.Error(), "a2a tasks/resubscribe:") {
var rpcErr struct{ Message string; Code int }
// extract message/code; route on code (-32602, task-not-found, auth)
}
case ev := <-events:
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- tasks/resubscribe: status %d
- failed to parse stream chunk: %w
- anthropic stream error: %s
- failed to parse stream chunk: %w
- failed to parse stream chunk: %w
AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01).
Data as JSON: /api/errors/1d60d56d5e5bc25a.
Report an issue: GitHub.