[BUG] Switching between ChatGPT Codex to OpenAI API results in errors #4669

Closed
opened 2026-02-16 17:44:58 -05:00 by yindo · 5 comments
Owner

Originally created by @Dyaxler on GitHub (Jan 10, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

I have a ton of old sessions where I used OpenAI API models. When I switched over to ChatGPT Codex, any additional prompts sent in those sessions results in errors such as:

Item with id 'rs_08967cad41a1d1fc0069599e28be1881909a42ea84f1ab24cd' 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.

Additionally, going in the opposite direction (a session with ChatGPT messages --> OpenAI API) results in errors such as these:

Item with id 'rs_03cdea15e4352413016962aeb58374819da5149be98b1a7b1e' not found.

...under the hood I know exactly where this error is coming from. But I'm sure you all might even be aware of it already. Just thought I would point it out.

Plugins

None

OpenCode version

1.1.12

Steps to reproduce

  1. Use OpenCode with OpenAI API
  2. Create a session in OpenCode
  3. Type a few messages
  4. Switch to ChatGPT
  5. Open old session
  6. Type a message

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @Dyaxler on GitHub (Jan 10, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description I have a ton of old sessions where I used OpenAI API models. When I switched over to ChatGPT Codex, any additional prompts sent in those sessions results in errors such as: ```Item with id 'rs_08967cad41a1d1fc0069599e28be1881909a42ea84f1ab24cd' 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.``` Additionally, going in the opposite direction (a session with ChatGPT messages --> OpenAI API) results in errors such as these: ```Item with id 'rs_03cdea15e4352413016962aeb58374819da5149be98b1a7b1e' not found.``` ...under the hood I know exactly where this error is coming from. But I'm sure you all might even be aware of it already. Just thought I would point it out. ### Plugins None ### OpenCode version 1.1.12 ### Steps to reproduce 1. Use OpenCode with OpenAI API 2. Create a session in OpenCode 3. Type a few messages 4. Switch to ChatGPT 5. Open old session 6. Type a message ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the bug label 2026-02-16 17:44:58 -05:00
yindo closed this issue 2026-02-16 17:44:58 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 10, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #4445: Using GPT 5.1 Codex via OpenAI fails on the 2nd request - reports the exact same error 'Item with id rs_... not found. Items are not persisted when store is set to false'
  • #5101: Switching from an image supported model to a non-image model breaks the thread - related issue with switching between different model types breaking sessions

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 10, 2026): This issue might be a duplicate of existing issues. Please check: - #4445: Using `GPT 5.1 Codex` via OpenAI fails on the 2nd request - reports the exact same error 'Item with id rs_... not found. Items are not persisted when store is set to false' - #5101: Switching from an image supported model to a non-image model breaks the thread - related issue with switching between different model types breaking sessions Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Jan 10, 2026):

Yeah im aware of this ill fix

@rekram1-node commented on GitHub (Jan 10, 2026): Yeah im aware of this ill fix
Author
Owner

@EvanNotFound commented on GitHub (Jan 11, 2026):

I think it is caused by the messages following the first one continues to carry the references, and that ChatGPT plus side and OpenAI api side doesn't share the it's reference data. So i think we might just omit those references when using third party OpenAI compatible apis

@EvanNotFound commented on GitHub (Jan 11, 2026): I think it is caused by the messages following the first one continues to carry the references, and that ChatGPT plus side and OpenAI api side doesn't share the it's reference data. So i think we might just omit those references when using third party OpenAI compatible apis
Author
Owner

@Dyaxler commented on GitHub (Jan 11, 2026):

@rekram1-node I forgot to mention a more detailed use case centered around this issue. First of all, this bug doesn't really apply to subagent delegations because they are operationally new sessions being spawned each time a subagent is delegated. So, you can safely switch your subagent models mid-session; unless one day OpenCode introduces multi-turn, reusable subagent sessions which I can't imagine why.

My issue comes specifically from the primary session (my Orchestrator) switching models' mid-session.

I did play around with a third-party ChatGPT OAuth plugin before this release and ran into a similar issue except I was able to switch to a ChatGPT model and continue in older sessions that had been started with an API model. The issue I ran into there was that going back to an API model resulted in errors and had to write a script to remove those records from the internal memory storage in order to once again load up that session and continue using an API model.

Question, are you guys going to support both API and OAuth loaded at the same time within OpenCode? Or is it only either or... Right now, you can't use both at the same time since the OAuth and API values are living under the same key name in auth.json. Same thing goes for Anthropic OAuth vs API. You have to choose one or the other. Not a big deal, I'm just curious. Most of the time I use the API models because I do a lot of heavy, non-commercial AI work and hit the limits quite often with the pay-per-month subscription. I'm at that cusp where it's least expensive for me to pay for API usage vs having a higher-level monthly subscription that gives you the higher limits. But I think I'd rather have a pay-per-month subscription for my "normal" month to month usage and retain the ability to flip over to the API when I hit a limit during those months of heavy project work. Yeah, I could just simply flip my auth.json around and reload the session, but it's kind of annoying. I'm working on a "pre-flight" workflow that checks a request before sending it to see if it would blow any limits, if it looks like it will, I send that request to a different provider and let the other one "cool off" for a bit before flipping back to it. I would LOVE to be able to fold in this workflow to primarily use the OAuth subs and fall back to an API path until the limits have cleared.

@Dyaxler commented on GitHub (Jan 11, 2026): @rekram1-node I forgot to mention a more detailed use case centered around this issue. First of all, this bug doesn't really apply to subagent delegations because they are operationally new sessions being spawned each time a subagent is delegated. So, you can safely switch your subagent models mid-session; unless one day OpenCode introduces multi-turn, reusable subagent sessions which I can't imagine why. My issue comes specifically from the primary session (my Orchestrator) switching models' mid-session. I did play around with a third-party ChatGPT OAuth plugin before this release and ran into a similar issue except I was able to switch to a ChatGPT model and continue in older sessions that had been started with an API model. The issue I ran into there was that going back to an API model resulted in errors and had to write a script to remove those records from the internal memory storage in order to once again load up that session and continue using an API model. Question, are you guys going to support both API and OAuth loaded at the same time within OpenCode? Or is it only either or... Right now, you can't use both at the same time since the OAuth and API values are living under the same key name in `auth.json`. Same thing goes for Anthropic OAuth vs API. You have to choose one or the other. Not a big deal, I'm just curious. Most of the time I use the API models because I do a lot of heavy, non-commercial AI work and hit the limits quite often with the pay-per-month subscription. I'm at that cusp where it's least expensive for me to pay for API usage vs having a higher-level monthly subscription that gives you the higher limits. But I think I'd rather have a pay-per-month subscription for my "normal" month to month usage and retain the ability to flip over to the API when I hit a limit during those months of heavy project work. Yeah, I could just simply flip my `auth.json` around and reload the session, but it's kind of annoying. I'm working on a "pre-flight" workflow that checks a request before sending it to see if it would blow any limits, if it looks like it will, I send that request to a different provider and let the other one "cool off" for a bit before flipping back to it. I would LOVE to be able to fold in this workflow to primarily use the OAuth subs and fall back to an API path until the limits have cleared.
Author
Owner

@rekram1-node commented on GitHub (Jan 16, 2026):

This should be fixed in the next release (1.1.24) by commit: https://github.com/anomalyco/opencode/commit/40836e96835862e98e042d3fc0869970eaaaedfb

@rekram1-node commented on GitHub (Jan 16, 2026): This should be fixed in the next release (1.1.24) by commit: https://github.com/anomalyco/opencode/commit/40836e96835862e98e042d3fc0869970eaaaedfb
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4669