micro/go-micro · error
a2a %s: %s (%d)
Error message
a2a %s: %s (%d)
What it means
call is the generic JSON-RPC invoker used by SendMessage, SetPushNotificationConfig, and PushNotificationConfig. The library throws this error when the HTTP response decodes successfully but carries a non-null JSON-RPC error object, formatting it as 'a2a <method>: <message> (<code>)'. It distinguishes application-level rejections from transport failures.
Source
Thrown at gateway/a2a/client.go:263
if err != nil {
return nil, err
}
req.Header.Set("Content-Type", "application/json")
resp, err := c.http.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
var out struct {
Result json.RawMessage `json:"result"`
Error *rpcError `json:"error"`
}
if err := json.NewDecoder(resp.Body).Decode(&out); err != nil {
return nil, err
}
if out.Error != nil {
return nil, fmt.Errorf("a2a %s: %s (%d)", method, out.Error.Message, out.Error.Code)
}
return out.Result, nil
}
func terminal(state string) bool {
switch state {
case "completed", "failed", "canceled", "rejected", "input-required":
return true
}
return false
}
func artifactsText(arts []Artifact) string {
var parts []Part
for _, a := range arts {
parts = append(parts, a.Parts...)
}
return textOf(parts)View on GitHub (pinned to 24529f1404)
Solutions
- Map the JSON-RPC code: -32601 method not found (spec/agent version mismatch), -32602 invalid params (fix payload), task-not-found codes (re-send or poll), auth codes (fix credentials).
- Compare your client and agent A2A protocol versions; upgrade the client or pin the agent to a compatible version.
- Validate Message Parts and push notification config fields before sending.
- Retry only for transient server-side codes; do not retry invalid-param or not-found errors.
Defensive patterns
Strategy: try-catch
Try / catch
result, err := c.SendMessage(ctx, msg)
if err != nil {
if m := rpcRe.FindStringSubmatch(err.Error()); m != nil {
method, message, code := m[1], m[2], m[3]
switch code {
case "-32601": // method not found: version mismatch
case "-32602": // invalid params: fix payload
}
}
return err
} Prevention
- Validate Message Parts and push config payloads before sending
- Match client protocol version to the agent's advertised capabilities
- Do not retry invalid-param or not-found codes; retry only transient 5xx-class codes
- Keep credentials current for auth-coded errors
When it happens
Trigger: Any of the call-based methods (SendMessage, SetPushNotificationConfig, PushNotificationConfig) receives a JSON-RPC error frame: method not found, invalid params (malformed Message/Part or push config), task not found, or unauthorized.
Common situations: Agent implements an older A2A spec lacking a method the client calls; Message Parts use a kind the agent rejects; push notification config references an unknown task; API key/credential invalid at the agent.
Related errors
- a2a tasks/resubscribe: %s (%d)
- ${rsp.Status}: ${body} (dynamic HTTP status and body)
- no response from API
- no response from API
- no response from API
AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01).
Data as JSON: /api/errors/d59aac93447359d9.
Report an issue: GitHub.