[Bug]: v0.3 SendMessage returns Internal error instead of InvalidParams for a missing messageId or empty parts
维护者通常 1 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 20/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- java
调研方向
Read Convert_v0_3_To10RequestHandler and ProtoUtils_v0_3.FromProto, focusing on the message send paths named in the issue. Compare how v1.0 converts these validation exceptions to invalid-params errors. The issue says a fix is already being opened in linked PR #1337, so check that work before taking this on.
由索引模型根据 Issue 内容生成。
描述
What happened?
In the v0.3 compatibility layer, a SendMessage whose message has no messageId or an empty parts list is only rejected with InvalidParamsError by JSON-RPC message/send. REST and gRPC report it as an internal error (HTTP 500 and INTERNAL), and so does JSON-RPC message/stream when messageId is missing.
Both checks throw IllegalArgumentException from a record constructor:
messageId:Message_v0_3accepts a nullmessageId, but the v1.0Messageit is converted to inMessageSendParamsMapper_v0_3.toV10(called fromConvert_v0_3_To10RequestHandler.onMessageSendandonMessageSendStream) throwsParameter 'messageId' may not be null.parts: on REST and gRPC,ProtoUtils_v0_3.FromProto.messagebuilds aMessage_v0_3, which throwsParts cannot be empty.
Only JSONRPCHandler_v0_3.onMessageSend maps that exception to InvalidParamsError_v0_3:
} catch (IllegalArgumentException t) {
return new SendMessageResponse_v0_3(request.getId(), new InvalidParamsError_v0_3(t.getMessage()));
}
Everywhere else it reaches catch (Throwable) and is reported as InternalError_v0_3. The v1.0 side does not have this problem, because ProtoUtils.FromProto.convert() turns the same exception into InvalidParamsError where it is raised.
Against the compat-0.3/tck server on main:
$ curl -s -w ' [%{http_code}]' localhost:9999/v1/message:send -H 'Content-Type: application/json' \
-d '{"message":{"role":"ROLE_USER","content":[{"text":"x"}]}}'
{"error": "org.a2aproject.sdk.compat03.spec.InternalError_v0_3", "message": "Internal error"} [500]
$ curl -s -w ' [%{http_code}]' localhost:9999/v1/message:send -H 'Content-Type: application/json' \
-d '{"message":{"messageId":"m-1","role":"ROLE_USER","content":[]}}'
{"error": "org.a2aproject.sdk.compat03.spec.InternalError_v0_3", "message": "Internal error"} [500]
The v0.3 TCK reports this for REST and gRPC in the tck-test-0-3 job of the Run TCK workflow on main: test_missing_required_message_fields (Expected InvalidParams error code -32602 for missing messageId, but got: -32603) and test_empty_arrays. The JSON-RPC streaming case is not covered by the TCK.
Expected: InvalidParamsError_v0_3 on every transport, as JSON-RPC message/send returns.
Actual: InternalError_v0_3 (HTTP 500 for REST message:send, an InternalError_v0_3 event for message:stream, INTERNAL over gRPC, -32603 for JSON-RPC message/stream).
Suggested fix: convert the IllegalArgumentException to an invalid params error where it is raised, as v1.0 does: around MessageSendParamsMapper_v0_3.INSTANCE.toV10(...) in Convert_v0_3_To10RequestHandler, and in ProtoUtils_v0_3.FromProto.messageSendParams. That covers the three transports without catching unrelated exceptions in the handlers.
I have a fix ready and I'm opening a PR alongside this issue.
Code of Conduct
- I agree to follow this project's Code of Conduct
- 主要语言
- Java
- 星标
- 514
- 派生
- 200
- 平均合并
- 1 天 2 小时
- 30 天内合并 PR
- 53
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
a2aproject/a2a-java 的其他 Issue
-
Document 1.x is the actively supported stream, and not 0.3.x可能已有人在做 @Linux2010 于 2 天前认领。 未关闭
难度 1/5 1-3 小时 新手友好度 62/100
a2aproject/a2a-java#1321 ·
维护者通常 1 天内回复
-
HTTP+JSON CancelTask returns 409 Conflict instead of 400 Bad Request for TaskNotCancelableError可能重新可做 @ravismash 于 9 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
a2aproject/a2a-java#1298 · 5 条评论 ·
维护者通常 1 天内回复
-
fix: handle blank push notification config id consistently across transports可能已有人在做 @prachisinghal-1 于 23 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
a2aproject/a2a-java#1012 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
a2aproject/a2a-java#464 · 1 条评论 ·
维护者通常 1 天内回复
-
Create a sample that demonstrates how to use a shared contextId across multiple tasks可能重新可做 @tanish111 于 390 天前认领,目前没有进行中的 PR。 未关闭sample
难度 2/5 1-3 小时 新手友好度 70/100
a2aproject/a2a-java#375 · 5 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 a2aproject/a2a-java 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
apache/skywalking#14239 ·
维护者通常 1 天内回复
-
account bug exercise lecture modeling programming
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
Re-executed query with IN condition on an index column returns deleted rows (stale IndexCursor)可能已有人在做 @dbusche 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
h2database/h2database#4580 ·
维护者通常 1 天内回复
-
vips-drift
难度 2/5 1-3 小时 新手友好度 74/100
Stirling-Tools/JPDFium#300 ·
维护者通常 1 天内回复
-
hermes-queue
难度 1/5 1-3 小时 新手友好度 85/100
chrisalunlloyd2-sudo/mindpalace#403 ·
维护者通常 1 天内回复