[Bug]: v0.3 SendMessage returns Internal error instead of InvalidParams for a missing messageId or empty parts
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 20/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- java
- Ambito
- backend-api-design
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Java
- Stelle
- 514
- Fork
- 200
- Merge medio
- 1g 2h
- PR unite (30g)
- 53
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di a2aproject/a2a-java
-
Document 1.x is the actively supported stream, and not 0.3.xForse già presa @Linux2010 l’ha presa 2 giorni fa. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 62/100
a2aproject/a2a-java#1321 ·
I maintainer di solito rispondono entro 1 giorno
-
HTTP+JSON CancelTask returns 409 Conflict instead of 400 Bad Request for TaskNotCancelableErrorForse di nuovo libera @ravismash l’ha presa 9 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
a2aproject/a2a-java#1298 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
fix: handle blank push notification config id consistently across transportsForse già presa @prachisinghal-1 l’ha presa 23 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
a2aproject/a2a-java#1012 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
a2aproject/a2a-java#464 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Create a sample that demonstrates how to use a shared contextId across multiple tasksForse di nuovo libera @tanish111 l’ha presa 390 giorni fa e non c’è nessuna pull request aperta. Apertasample
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
a2aproject/a2a-java#375 · 5 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di a2aproject/a2a-java
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/skywalking#14239 ·
I maintainer di solito rispondono entro 1 giorno
-
account bug exercise lecture modeling programming
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
Re-executed query with IN condition on an index column returns deleted rows (stale IndexCursor)Forse già presa @dbusche l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
h2database/h2database#4580 ·
I maintainer di solito rispondono entro 1 giorno
-
vips-drift
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Stirling-Tools/JPDFium#300 ·
I maintainer di solito rispondono entro 1 giorno
-
hermes-queue
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
chrisalunlloyd2-sudo/mindpalace#403 ·
I maintainer di solito rispondono entro 1 giorno