Skip to content

[Bug]: SendMessage with unknown taskId creates a new task instead of returning TaskNotFoundError #766

@jmesnil

Description

@jmesnil

What happened?

Summary

When SendMessage includes a taskId that does not correspond to an existing task, the SUT creates a new task using the provided taskId instead of returning TaskNotFoundError. This affects all three transports.

Additionally, the status message in the response contains empty contextId and taskId fields, which should either be omitted or populated.

Requirement

Specification

When a client includes a taskId in a Message, it MUST reference an existing task.
Agents MUST return a TaskNotFoundError if the provided taskId does not correspond to an existing task.
Client-provided taskId values for creating new tasks is NOT supported.

Expected behavior

SendMessage with a non-existent taskId should return TaskNotFoundError:

  • JSON-RPC: error code -32001
  • gRPC: status NOT_FOUND
  • HTTP+JSON: status 404 Not Found

Actual behavior

The SUT creates a new task using the client-provided taskId, processes it (reaching TASK_STATE_COMPLETED), and returns success. The status message in the response also contains empty contextId and taskId fields:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "task": {
      "id": "does-not-exist-99999",
      "contextId": "b37f0cf9-5daf-4e98-a9d8-c05e1cb54eea",
      "status": {
        "state": "TASK_STATE_COMPLETED",
        "message": {
          "messageId": "30714123-0f06-477a-a81f-239fb97e1b5b",
          "contextId": "",
          "taskId": "",
          "role": "ROLE_AGENT",
          "parts": [{"text": "Unhandled messageId prefix: test-repro-001"}],
          ...
        }
      }
    }
  }
}

On subsequent calls with the same taskId, it returns UnsupportedOperationError because the task is now terminal.

Reproducer

# Send a message with a nonexistent taskId
# Expected: TaskNotFoundError (-32001)
# Actual: SUT creates a new task with the client-provided taskId and returns success
curl -s -X POST http://localhost:9999/ \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":"1","method":"SendMessage","params":{"message":{"messageId":"test-repro-001","taskId":"does-not-exist-99999","role":"ROLE_USER","parts":[{"text":"Hello"}]}}}'

# Response: 200 OK with task created using id "does-not-exist-99999"
#   - task.status.message.contextId is empty ("")
#   - task.status.message.taskId is empty ("")
# Expected: {"jsonrpc":"2.0","id":1,"error":{"code":-32001,"message":"Task not found"}}

TCK test

tests/compatibility/core_operations/test_requirements.py::test_must_requirement[CORE-MULTI-004-grpc]
tests/compatibility/core_operations/test_requirements.py::test_must_requirement[CORE-MULTI-004-jsonrpc]
tests/compatibility/core_operations/test_requirements.py::test_must_requirement[CORE-MULTI-004-http_json]

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibilityIssue related to A2A compatibility

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions