Repository navigation
fix(rag-haystack): fail the retrieval on a non-2xx response - #4131
Merged
jujn merged 1 commit intoNov 13, 2026
Merged
Conversation
retrieve() logged a non-2xx status and then parsed the body anyway. A gateway error body carries no code field, so the response came back to the caller as a successful retrieval with no documents. Throw HayStackApiException carrying the HTTP status before parsing.
ningmao-hlyz
force-pushed
the
fix/haystack-http-status-fails
branch
from
November 11, 2026 12:37
09446f9 to
96eca93
Compare
jujn
approved these changes
Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AgentScope-Java Version
2.1.0-SNAPSHOT (main at
2d70942c)Description
Fixes #4130.
HayStackClient.retrievelogged a non-2xx status and then parsed the body anyway. The only failure check after that iscode != null && code != successCode, so an error body without acodefield (a gateway 502/503, or a proxy error page that happens to be JSON) came back to the caller as a successful retrieval with no documents.This throws
HayStackApiExceptioncarrying the HTTP status before parsing, and keeps the body in the existing log line.DifyRAGClientalready fails on the status the same way.How to test:
mvn -pl agentscope-extensions/agentscope-extensions-rag/agentscope-extensions-rag-haystack test. The new test fails before the change (Expected HayStackApiException to be thrown, but nothing was thrown) and passes after.A
200whose body carries nocodeis untouched: it is indistinguishable from a response with no documents, and this change is scoped to the transport-level signal.