Checked other resources
Example Code
To reproduce:
const client = new Client({ apiUrl: "http://localhost:2024" });
try {
await client.threads.get("nonexistent-thread");
} catch (err) {
console.log(err.response); // undefined, even though the request failed with a real HTTP response
}
Environment: @langchain/langgraph-sdk, current main as of 2026-07-24
Error Message and Stack Trace (if applicable)
No response
Description
When an API call made through Client fails, the resulting error's .response property is undefined unless the client was configured with callerOptions.onFailedResponseHook.
This is because in libs/sdk/src/utils/async_caller.ts, HTTPError.fromResponse is called with includeResponse: !!onFailedResponseHook — the raw response is only attached as a side effect of registering that hook, which is meant for something else (e.g. logging/telemetry on failure), not for consumers who just want to inspect the response on error.
Expected behavior: There should be an explicit, independent option (e.g. callerOptions.includeResponseOnError or simply always attaching error.response) so callers can access the failed response without having to register an unrelated hook.
System Info
this is on latest right now
Checked other resources
Example Code
To reproduce:
Environment: @langchain/langgraph-sdk, current main as of 2026-07-24
Error Message and Stack Trace (if applicable)
No response
Description
When an API call made through Client fails, the resulting error's .response property is undefined unless the client was configured with callerOptions.onFailedResponseHook.
This is because in libs/sdk/src/utils/async_caller.ts, HTTPError.fromResponse is called with includeResponse: !!onFailedResponseHook — the raw response is only attached as a side effect of registering that hook, which is meant for something else (e.g. logging/telemetry on failure), not for consumers who just want to inspect the response on error.
Expected behavior: There should be an explicit, independent option (e.g. callerOptions.includeResponseOnError or simply always attaching error.response) so callers can access the failed response without having to register an unrelated hook.
System Info
this is on latest right now