Skip to content

[BUG] kagent invoke fails with "cannot unmarshal object into []*errordetails.Typed" for agents without SupportedInterfaces #2270

Description

@codechamp1

📋 Prerequisites

  • I have searched the existing issues to avoid creating a duplicate
  • By submitting this issue, you agree to follow our Code of Conduct
  • I am using the latest version of the software
  • I have tried to clear cache/cookies or used incognito mode (if ui-related)
  • I can consistently reproduce this issue

🎯 Affected Service(s)

Multiple services / System-wide issue

🚦 Impact/Severity

Blocker

🐛 Bug Description

Bug Description

kagent invoke fails with a JSON-RPC internal error for all declarative agents. The controller selects the wrong A2A transport version when an agent's card does not advertise SupportedInterfaces, causing a JSON unmarshalling panic when the agent returns any error response.

🔄 Steps To Reproduce

  1. Install kagent 0.10.0-beta7
  2. Create a declarative agent via kubectl apply
  3. Run:
    kagent invoke --agent <agent-name> --task "hello"
    

🤔 Expected Behavior

The agent responds to the task normally, same as when invoked via the UI.

📱 Actual Behavior

ERROR client/client.go:302  JSON-RPC error in SSE event for request : jsonrpc error -32603:
failed to decode response: json: cannot unmarshal object into Go struct field
Error.error.data of type []*errordetails.Typed

The invocation always fails. The UI works fine for the same agent.

💻 Environment

  • kagent version: 0.10.0-beta7
  • Controller image: ghcr.io/kagent-dev/kagent/controller:0.10.0-beta7
  • Kubernetes: GKE
  • OS: macOS

🔧 CLI Bug Report

No response

🔍 Additional Context

Possible Root Cause

File: go/core/internal/a2a/a2a_registrar.go
Function: filterInterfacesByVersion

The controller registers a v0.3 compat transport (a2av0.NewJSONRPCTransport) to talk to agent pods, but it is only selected when the agent card advertises SupportedInterfaces with ProtocolVersion: "0.3". Declarative agents created via kubectl apply do not advertise SupportedInterfaces, so filterInterfacesByVersion returns unversioned interfaces and the v1 transport is selected instead.

When the agent pod returns any error (e.g. a 400 from the upstream LLM), the v1 transport tries to decode error.data as []*errordetails.Typed (array), but the agent pod running the v0.3 wire format sends it as a JSON object {}. Unmarshalling fails and the controller returns a -32603 internal error to the CLI.

Workaround

Port-forward directly to the agent pod (bypassing the controller) and call it via curl:

kubectl port-forward -n kagent svc/<agent-name> 9091:8080

curl -s -X POST http://localhost:9091 \
  -H "Content-Type: application/json" \
  -d "{
    \"jsonrpc\":\"2.0\",
    \"method\":\"message/send\",
    \"params\":{
      \"message\":{
        \"messageId\":\"msg-1\",
        \"role\":\"user\",
        \"parts\":[{\"kind\":\"text\",\"text\":\"your task here\"}]
      }
    },
    \"id\":1
  }" | jq '.result.artifacts[0].parts[0].text'

📋 Logs

📷 Screenshots

No response

🙋 Are you willing to contribute?

  • I am willing to submit a PR to fix this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions