Skip to content

[QUESTION] Exception is thrown when using A2A client #946

Closed

Description

@lordofthejars

Hi I am developing an Agent, and I am using the Agent Client to test it.

The test is here: https://github.com/lordofthejars-ai/galaxium-travels/blob/main/incidence-response-agent/src/test/java/org/acme/incidence/IncidenceResponseAgentTest.java

And the Agent declaration is at https://github.com/lordofthejars-ai/galaxium-travels/blob/main/incidence-response-agent/src/main/java/org/acme/incidence/IncidenceResponseAgentExecutorProducer.java

Then currently the example is working because I am using the agentEmitter.sendMessage(parts); method at the agent, but if you look at the agent execute method you'll see some code commented:

if (context.getTask() == null) {
                agentEmitter.submit();
}
agentEmitter.startWork();

agentEmitter.addArtifact(parts);
agentEmitter.complete();

And I comment the sendMessage method, then when I run the test, I got an exception that the request has been cancelled. Now I am not sure why I am getting this exception if I am not cancelling anything.

Thank you very much for your help, to reproduce the issue you only need to run the test. All it is self contained.
Thank you very much.

Activity

  1. self-assigned this
    on Jun 22, 2026
  2. ehsavoie commented on Jun 22, 2026

    @ehsavoie
    Collaborator

    This is due to the Jdk HttpClient, if you use the vertx client it works. Your error handleris logging all exceptions — including this intentional cancellation. The server-side log confirms it: "SSE connection closed by client, calling EventConsumer.cancel() to stop polling loop" — the server sees the client disconnect and cleans up its side too.

  3. ehsavoie commented on Jun 22, 2026

    @ehsavoie
    Collaborator

    Also note that the streamingErrorHandler should be able to handle null

  4. added
    wontfix
    on Jun 22, 2026
  5. lordofthejars commented on Jun 22, 2026

    @lordofthejars
    Author

    Ok, I am going to take a look at how this should be, so first, not using the JDK client, which I suppose is the default one. Ok, now I am a bit lost because I followed the tutorial on the webpage, so I'm not understanding exactly why I am facing this problem, but thanks for giving me some direction to follow.

  6. ehsavoie commented on Jun 22, 2026

    @ehsavoie
    Collaborator

    The "problem" is that you are tracing all the exception in the error handler so yo are tracing this 'expected' exception. Maybe we should provide a 'proper' default error handler

  7. lordofthejars commented on Jun 22, 2026

    @lordofthejars
    Author

    ok I am going to check null for error var

  8. ehsavoie commented on Jun 22, 2026

    @ehsavoie
    Collaborator

    I sent a PR on your repo

  9. added 2 commits that reference this issue on Jun 25, 2026
    2944eef
    d200ed0
  10. added a commit that references this issue on Jun 29, 2026
    4d746aa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

wontfix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions