langchain - 💡(How to fix) Fix langchain-openrouter: `rs_*` reasoning IDs cause 404 on `/responses` replay across upstreams

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Provider returned error 404 "error": {

Root Cause

The deepagents-side mitigation in langchain-ai/deepagents#3157 set openrouter_provider={"ignore": ["azure"]} on the assumption that Azure's stateless /responses was the offender. Reproduction with that mitigation applied (deepagents 0.5.7, langchain-openrouter 0.2.3) shows the same 404 from OpenAI direct — confirming the root cause is OpenRouter's /responses plumbing, not any single upstream.

Fix Action

Fix / Workaround

The deepagents-side mitigation in langchain-ai/deepagents#3157 set openrouter_provider={"ignore": ["azure"]} on the assumption that Azure's stateless /responses was the offender. Reproduction with that mitigation applied (deepagents 0.5.7, langchain-openrouter 0.2.3) shows the same 404 from OpenAI direct — confirming the root cause is OpenRouter's /responses plumbing, not any single upstream.

  • langchain-ai/deepagents#3157 — Azure-specific workaround that masked the broader bug
  • langchain-ai/deepagents#3174 — original tracker, closed pointing here

Code Example

Provider returned error 404
{
  "error": {
    "message": "Item with id 'rs_053a05e24b0da75e0169fa358ea9fc81908b18aff8157798c1' not found. Items are not persisted when `store` is set to false. Try again with `store` set to true, or remove this item from your input.",
    "type": "invalid_request_error",
    "param": "input"
  }
}
provider_name: OpenAI
is_byok: false
RAW_BUFFERClick to expand / collapse
  • I am a LangChain maintainer, or was asked directly by a LangChain maintainer to create an issue here.

Issue Content

Filed from langchain-ai/deepagents#3174 (closing that as upstream — this is the canonical tracker).

ChatOpenRouter forwards reasoning_content / reasoning_details from assistant additional_kwargs on subsequent turns. Those payloads include opaque rs_* reasoning item IDs. OpenRouter's /responses beta does not propagate store=true / previous_response_id across upstreams, so replayed rs_* IDs 404 regardless of which upstream OpenRouter selects.

Symptoms users hit:

Provider returned error 404
{
  "error": {
    "message": "Item with id 'rs_053a05e24b0da75e0169fa358ea9fc81908b18aff8157798c1' not found. Items are not persisted when `store` is set to false. Try again with `store` set to true, or remove this item from your input.",
    "type": "invalid_request_error",
    "param": "input"
  }
}
provider_name: OpenAI
is_byok: false

The deepagents-side mitigation in langchain-ai/deepagents#3157 set openrouter_provider={"ignore": ["azure"]} on the assumption that Azure's stateless /responses was the offender. Reproduction with that mitigation applied (deepagents 0.5.7, langchain-openrouter 0.2.3) shows the same 404 from OpenAI direct — confirming the root cause is OpenRouter's /responses plumbing, not any single upstream.

Options

  1. Strip rs_* reasoning item IDs from outbound messages in langchain-openrouter. Preserve textual reasoning content, drop opaque IDs that the upstream can't resolve. Smallest blast radius; safe for non-OpenRouter callers because the change is package-local.
  2. Force chat-completions semantics for OpenRouter requests so the /responses replay path is never taken. Bigger behavior change but sidesteps the problem entirely.
  3. Pure docs: confirm with OpenRouter whether state propagation has shipped, and document the constraint. Not a fix.

Option 1 looks like the right starting point. Happy to send a PR if a maintainer wants to weigh in on the approach first.

Cross-refs

  • langchain-ai/deepagents#3157 — Azure-specific workaround that masked the broader bug
  • langchain-ai/deepagents#3174 — original tracker, closed pointing here

Package (Required)

  • langchain-openrouter

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING