You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support a --continue flag to persist context in a new session #1207
Due to issues like #725, where limits aren't clear and no messaging is provided, it's easy to assume that OpenCode has just stopped working, so moving to another tool such as Amp or Claude Code is the assumed solution. However, those tools then inform you that limits have been reached. At that point though, context for OpenCode has been lost, so I need to interact with the tool to get it back up to speed with where we were.
Suggestion
Given we have a /share command, I would assume that there is some context stored for the current conversation. Would it be possible to therefore support a --continue flag when running opencode so that the previous conversation can continue and context is not lost? I would assume there are some logs or session information in the locally stored DB?
I appreciate that's a few assumptions, but I'd like to continue to use OpenCode and not have to quit out to check that usage limits are the issue, losing my progress and conversation.
Else, can we add information on usage limits to the conversation window?
@thdxr wow. 😬Apologies for wasting your time even opening this. This is clearly me being dumb; I just assumed it would be a flag or sub command on the opencode command.
I'll close this and just thank you for providing such a great tool.
maybe im not following but can't you open the session list and get back to the old session?
@thdxr I actually have this issue I was in a session and now the session list is empty and cannot continue my old session, are they perhaps stored somewhere?
ok i exported the session that i had started just in case, then deleted that migration you had me 'cat' and then started opencode and i have only my single new session there and not old one from before
let me know if i should add logs from yesterday since i noticed the issue of missing session then, it seems i have more logs from yesterday with larger sizes
@rekram1-node here is the log i think around when the session went missing because i was getting errors that were popping up and after that i noticed my session was gone this one has error logs along with info
thanks for the tips btw much appreciate you looking into this... one last question any way to try to prevent session loss in the future? should i just export daily the sessions?
no problem, it is hard to say because I don't know what caused loss here, you could've changed the dir name, accidentally deleted, a whole host of things.
I haven't had any sessions randomly disappear but if you are super worried about sessions then maybe making a /share link would be useful.
I think super long sessions are generally an anti pattern so I always split them up per task rather than 1 giant one
@rekram1-node I have also had the issue of sessions disappearing from the /sessions list.
I can see that there are still a number of sessions stored in json files in ~/.local/share/opencode/storage/sessions, and a bunch of corresponding messages, but they are not listed when i use the command in tui.
my migration file just says '2' and i've observed this in version 1.0.45, and not resolved by updating to 1.0.55
I also tried the steps you mentioned above, deleting the migration file and re-running the tui, but no change to the empty session list.
attempting to load the session directly using the -s <session_id> flag yield the following error:
INFO 2025-11-10T13:09:13 +69ms service=config path=/home/acorn/.config/opencode/config.json loading
INFO 2025-11-10TERROR 2025-11-10T13:09:14 +339ms service=default e=undefined is not an object (evaluating 'scroll.scrollTo') exception
rvice=config path=/home/acorn/.config/opencode/opencode.jsonc loading
INFO 2025-11-10T13:09:13 +23ms service=server method=GET path=/config/providers request
INFO 2025-11-10T13:09:13 +0ms service=server status=started method=GET path=/config/providers request
and attempting to opencode import the session from the file name, fails with a different error, but i assume this is because "exported" sessions have a different format? :
ERROR 2025-11-10T13:10:55 +8ms service=default name=TypeError message=undefined is not an object (evaluating 'exportData.info.id') stack=TypeError: undefined is not an object (evaluating 'exportData.info.id')
at <anonymous> (src/cli/cmd/import.ts:84:71)
at processTicksAndRejections (native:7:39) fatal
I've searched the issues and i can't see any currently open or active ticket tracking this. Should i create one?
I hope this extra information is useful for debugging, please let me know if you discover a way i can restore these sessions 🤞🏼
maybe im not following but can't you open the session list and get back to the old session?
IN the case where i moved the folder to a new path, i notice that there are no previous sessions
Is there a way to fix this
I tried exporting session to md file from opencode tui, it generated an md file then i tried opencode import, however it only works with json or opencode.ai urls
Activity
thdxr commentedon Jul 22, 2025
maybe im not following but can't you open the session list and get back to the old session?
mcncl commentedon Jul 31, 2025
@thdxr wow. 😬Apologies for wasting your time even opening this. This is clearly me being dumb; I just assumed it would be a flag or sub command on the
opencodecommand.I'll close this and just thank you for providing such a great tool.
davidchase commentedon Sep 4, 2025
@thdxr I actually have this issue I was in a session and now the session list is empty and cannot continue my old session, are they perhaps stored somewhere?
rekram1-node commentedon Sep 4, 2025
@davidchase I think you migrations may have failed, I can help you debug.
What version of opencode are you on, what do you see if you run:
davidchase commentedon Sep 4, 2025
That would be awesome @rekram1-node !
➜ ~ opencode --version
0.6.4
➜ ~ cat ~/.local/share/opencode/storage/migration
1
rekram1-node commentedon Sep 4, 2025
@davidchase delete that migration file I just had you cat, then start opencode
it will run the migrations for say 10 seconds to a minute or so (no visual indication atm)
once it is done the tui will boot
rekram1-node commentedon Sep 4, 2025
once that happens first:
check if you have any sessions listed
if not:
show me the latest log file
it would be in ~/.local/share/opencode/log/
davidchase commentedon Sep 4, 2025
will the migration delete the session i have started since ive lost the previous one? i dont want to lose the new one too
rekram1-node commentedon Sep 4, 2025
it shouldn’t but I can double check if you want
davidchase commentedon Sep 4, 2025
ok i exported the session that i had started just in case, then deleted that migration you had me 'cat' and then started opencode and i have only my single new session there and not old one from before
rekram1-node commentedon Sep 4, 2025
@davidchase can you show me the latest log file
davidchase commentedon Sep 4, 2025
sure the log from today is
davidchase commentedon Sep 4, 2025
let me know if i should add logs from yesterday since i noticed the issue of missing session then, it seems i have more logs from yesterday with larger sizes
rekram1-node commentedon Sep 4, 2025
I suppose it doesn't hurt, mostly what I need is the logs immediately after deleting the migration and then rerunning opencode
davidchase commentedon Sep 4, 2025
the logs i shared above are from today after deleting that migration file
rekram1-node commentedon Sep 4, 2025
That's very strange then, looks like no errors… did you run it in the same dir that previously had the session you were looking for?
davidchase commentedon Sep 4, 2025
yes i working in ~/chiron that had the original session that was lost and now started a new session same directory
rekram1-node commentedon Sep 4, 2025
Hmm I'm not really sure then maybe some failure is happening silently I will check
davidchase commentedon Sep 4, 2025
@rekram1-node here is the log i think around when the session went missing because i was getting errors that were popping up and after that i noticed my session was gone this one has error logs along with info
2025-08-29T131955.log
rekram1-node commentedon Sep 4, 2025
Hmm still no errors related to what I'd expect
davidchase commentedon Sep 4, 2025
so probably no way to recover it?
rekram1-node commentedon Sep 4, 2025
you can try looking around in ~/.local/share/opencode/storage/ but recovering likely requires a bit of work
davidchase commentedon Sep 4, 2025
thanks for the tips btw much appreciate you looking into this... one last question any way to try to prevent session loss in the future? should i just export daily the sessions?
rekram1-node commentedon Sep 4, 2025
no problem, it is hard to say because I don't know what caused loss here, you could've changed the dir name, accidentally deleted, a whole host of things.
I haven't had any sessions randomly disappear but if you are super worried about sessions then maybe making a /share link would be useful.
I think super long sessions are generally an anti pattern so I always split them up per task rather than 1 giant one
acornforth commentedon Nov 10, 2025
@rekram1-node I have also had the issue of sessions disappearing from the /sessions list.
I can see that there are still a number of sessions stored in json files in
~/.local/share/opencode/storage/sessions, and a bunch of corresponding messages, but they are not listed when i use the command in tui.my migration file just says '2' and i've observed this in version 1.0.45, and not resolved by updating to 1.0.55
I also tried the steps you mentioned above, deleting the migration file and re-running the tui, but no change to the empty session list.
attempting to load the session directly using the -s <session_id> flag yield the following error:
and attempting to
opencode importthe session from the file name, fails with a different error, but i assume this is because "exported" sessions have a different format? :I've searched the issues and i can't see any currently open or active ticket tracking this. Should i create one?
I hope this extra information is useful for debugging, please let me know if you discover a way i can restore these sessions 🤞🏼
rekram1-node commentedon Nov 10, 2025
@acornforth hm the import should still work id think
I have heard someone else have this issue tooo
maybe there is a bug if a message is created in a certain state then it breaks the session making it seem “deleted”
manascb1344 commentedon Jan 18, 2026
IN the case where i moved the folder to a new path, i notice that there are no previous sessions
Is there a way to fix this
I tried exporting session to md file from opencode tui, it generated an md file then i tried opencode import, however it only works with json or opencode.ai urls