Skip to content

How to unarchive in opencode-desktop #12393

Closed
Shaik121/opencode
#1

Description

@leavor

Question

I accidentally clicked 'Archive' on a session in opencode-desktop. How can I find it and get it back?

Image

opencode-desktop version is v1.1.53

Activity

  1. github-actions commented on Feb 6, 2026

    @github-actions
    Contributor

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

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

  2. github-actions commented on Apr 7, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  3. NashYang96 commented on Apr 29, 2026

    @NashYang96

    create a new session and just give it this prompt "My archived OpenCode chat session (your session name) are missing from the sidebar. They are stored in the SQLite database at ~/.local/share/opencode/opencode.db in the session table. The column time_archived is set to a timestamp when a session is archived. To restore them, set time_archived = NULL. Please run a query to show me all archived sessions, ask me which one to restore, and then run the UPDATE query to fix it." Restart after the execution! The session will be recovered!

  4. devbijay commented on Apr 30, 2026

    @devbijay

    opencode export > session-export.json
    jq 'del(.info.time.archived)' session-export.json > session-unarchived.json
    opencode session delete
    opencode import session-unarchived.json
    opencode --session

  5. SawLay043 commented on Apr 30, 2026

    @SawLay043

    Well, it was a weird way to find out this issue after I accidently miss pressed the caps lock and stuff, and my sessions went disappeared, lol.

  6. g19375592715-del commented on May 1, 2026

    @g19375592715-del

    test

  7. SinnySupernova commented on May 12, 2026

    @SinnySupernova

    on linux you can install sqlite3 cli and run sqlite3 ~/.local/share/opencode/opencode.db "SELECT id,title,slug,time_archived FROM session ORDER BY time_archived DESC LIMIT 1;" to get last archived session details- increase limit to get more sessions
    then run sqlite3 ~/.local/share/opencode/opencode.db "UPDATE session SET time_archived = NULL WHERE slug = 'PASTE_SLUG_HERE';" for the session you want to unarchive

  8. TimChinye commented on May 18, 2026

    @TimChinye

    Just accidentally pressed "CTRL+Alt+Backspace" and my super massive conversation just got deleted. It says "Archive", but there's seemingly no way to view archived conversations and/or bring them back - which is quite misleading. And there really should be a confirmation modal for such an irreversible action.

  9. zkxil commented on May 22, 2026

    @zkxil

    create a new session and just give it this prompt "My archived OpenCode chat session (your session name) are missing from the sidebar. They are stored in the SQLite database at ~/.local/share/opencode/opencode.db in the session table. The column time_archived is set to a timestamp when a session is archived. To restore them, set time_archived = NULL. Please run a query to show me all archived sessions, ask me which one to restore, and then run the UPDATE query to fix it." Restart after the execution! The session will be recovered!

    Thanks Yang, Really helps me a lot.

  10. FreeRide23 commented on May 23, 2026

    @FreeRide23

    WHY the fuck is this topic opened since FEB.6????
    How the fuck can a programm behave like this for over 5 months?
    Omfg.... can some one explain to me, how to edit the C:\Users\FreeRide23.local\share\opencode\opencode.db to reset the sessions???
    I read 20 different approaches, no one works.... cause there are terms like "TUI" what NO ONE EXPLAINS.....
    How the fuck should a normal person understand ANY SHIT that is written here????
    I dont have any fucking idea how to fucking open a database, or what to klick where to edit WHAT....

    So can anyone fucking explain this shit to me? IN SIMPLE FUCKING TERMS????

    This:
    "create a new session and just give it this prompt "My archived OpenCode chat session (your session name) are missing from the sidebar. They are stored in the SQLite database at ~/.local/share/opencode/opencode.db in the session table. The column time_archived is set to a timestamp when a session is archived. To restore them, set time_archived = NULL. Please run a query to show me all archived sessions, ask me which one to restore, and then run the UPDATE query to fix it." Restart after the execution! The session will be recovered!"

    Did not work, because I DO NOT FUCKING KNOW THE NAME OF THE SESSION......
    Also it does not work because it says i need to close the OpenCode software...

    I found this one:
    https://github.com/OllyJohnston/OpenCode-Archive-Session-Manager

    So you realy mean, i should install:
    Python
    Opencode TUI
    and then follow 20 steps of shit, just to install a FEATURE that should have been there 5 month ago????

    So your fix for a problem, is a installation process of its own????

    WHY THE FUCK can no one in this dev community ADD the CODE that is written ALLREADY here: #24153 ????

    WHO THE FUCK IS IN CHARGE OF THIS???? What ASS we need TO KICK to MAKE THIS FUCKING HAPPEN????????

    I realy love the open source community, but you fucking guys are missing the abilit to MAKE DECISIONS and MAKE IT HAPPEN!!!! FOR FUCK SAKE WHO IS IN CHARGE OF THIS SHIT?????

  11. giuliov commented on May 24, 2026

    @giuliov

    @FreeRide23 on Windows I suggest this:

    1. download a simple GUI like sqlite-gui
    2. open C:\Users\<YOURUSER>\.local\share\opencode\opencode.db (yes, I know it's unnatural, should be under C:\Users\<YOURUSER>\AppData\Roaming\opencode, sic)
    3. find the session e.g.
    SELECT id, title, slug, time_archived
    FROM session
    ORDER BY time_archived DESC
    LIMIT 1;

    to get last archived session details (copy-paste then press Execute)
    4. save the value of the slug cell (right-click, Copy cell)
    5. un-archive executing another command

    UPDATE session
    SET time_archived = NULL
    WHERE slug = 'PASTE_COPIED_SLUG_HERE';
    1. close and reopen Opencode Desktop

    at least it worked for me
    thanks @SinnySupernova for the tip

  12. FreeRide23 commented on May 24, 2026

    @FreeRide23

    SELECT id, title, slug, time_archived
    FROM session
    ORDER BY time_archived DESC
    LIMIT 1;
    to get last archived session details (copy-paste then press Execute) 4. save the value of the slug cell (right-click, Copy cell) 5. un-archive executing another command

    UPDATE session
    SET time_archived = NULL
    WHERE slug = 'PASTE_COPIED_SLUG_HERE';
    6. close and reopen Opencode Desktop

    DUDE! THX! That works!
    Finaly a good explanation!

    Ok, what i was missing (a friend helped me then) was the following information:

    You say "find the session e.g." and then post the SQL execution parameters....
    I told you, i dont know shit about databases....

    So what i was missing, was the information, Open the *.db with the SQL Lite viewer, then you see the Database, on the tab "database structure, Browse Data, Edit Pragmas, execute SQL" press the execute SQL tab.
    Then paste the code:
    SELECT id, title, slug, time_archived
    FROM session
    ORDER BY time_archived DESC
    LIMIT 1;

    Then press > run
    Now you find your the slug you need, the slug is showed below the execution window, copy the slug name and paste it into the other command:

    found slug:
    jolly-forest

    UPDATE session
    SET time_archived = NULL
    WHERE slug = 'PASTE_COPIED_SLUG_HERE';

    =

    UPDATE session
    SET time_archived = NULL
    WHERE slug = 'jolly-forest';

    Repeat it as often as you need (i needed to do it two times).

    This works!

    THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Fuck that shit, make that user interface work.... please, for fuck sake....

    I dont know if this programm is run by a dev community or a vibe coding community i realy dont care....
    All i see are endless treads, with different approaches, and it needs me to get fucking angry, to get a answer that helps....
    I see https://github.com/OllyJohnston/OpenCode-Archive-Session-Manager this and just get angry, because a simple explanation (that is now given) would solve all the problems.... and all the problems would not even exist, if the suggestion of the implementation of this bugfix would WORK in TIME.....

    So who ever is in charge of this shit here, get your shit together, for fuck sake.....

  13. GitBruced commented on Jun 7, 2026

    @GitBruced

    https://github.com/OllyJohnston/OpenCode-Archive-Session-Manager

    This worked! In TUI not the desktop version. FYI.

    it is unbelievable that such a shitty issue just needed an entire repo for providing a solid solution.

  14. galenfontaise commented on Jun 22, 2026

    @galenfontaise

    This: "create a new session and just give it this prompt "My archived OpenCode chat session (your session name) are missing from the sidebar. They are stored in the SQLite database at ~/.local/share/opencode/opencode.db in the session table. The column time_archived is set to a timestamp when a session is archived. To restore them, set time_archived = NULL. Please run a query to show me all archived sessions, ask me which one to restore, and then run the UPDATE query to fix it." Restart after the execution! The session will be recovered!"

    Did not work, because I DO NOT FUCKING KNOW THE NAME OF THE SESSION...... Also it does not work because it says i need to close the OpenCode software...

    Then just use a generic prompt "My archived OpenCode chat sessions are missing from the sidebar. They are stored ..."
    It will give you all of them, and you will be able to choose which ones to restore (you can select one, a few or all).

    It worked for me!

  15. planetzalex commented on Jul 9, 2026

    @planetzalex

    trash app by trash devs. you can tell when people don't dogfood.

  16. jeinselen commented on Jul 10, 2026

    @jeinselen

    @galenfontaise Similar prompt worked for me as well! This is the exact request I used in a new session:

    The OpenCode chat session we were just working on — I hadn't submitted my lengthy reply yet! — is missing from the sidebar; it was accidentally archived. Archived sessions are stored in the SQLite database at ~/.local/share/opencode/opencode.db in the session table. The column time_archived is set to a timestamp when a session is archived. To restore them, set time_archived = NULL. Please run a query to show me all archived sessions, ask me which one to restore, and then run the UPDATE query to fix it.
    

    ...I had to restart OpenCode Desktop before the restored session reappeared, and the un-submitted text didn't initially show up. I asked in the restoration session to restore text as well, and it claimed it wasn't possible. But when I went back to the restored session, there was all the un-submitted text I'd been working on. Immediately copied it to a text editor with deletion protection, finished drafting, and submitted. All seems to be working as expected.

    System: MacOS 26.5.1
    Model: Claude Opus 4.7 High (via OpenCode Zen)

    Total cost of the restoration session was $0.21. Really hope the developers can add an archive view in the GUI so we don't have to go through vibe coding our way back from an accidental deletion! I definitely removed the archive keyboard shortcut — it's far too close to existing text editing shortcuts in MacOS, and without restoration options built-in to the app, at the very least I don't think the shortcut should be enabled by default!

    And no, OpenCode is not trash software by trash devs; I very much appreciate all the work that goes into open source development, and I'm very glad for options like OpenCode! Even if occasionally it gives me a fright. 😬

  17. 1paramveer commented on Jul 21, 2026

    @1paramveer

    Total cost of the restoration session was $0.21.

    cant believe we have to pay for our own shit, this issue is still prevalent

  18. 21hook commented on Aug 8, 2026

    @21hook

    Fork a new session from the archive one using OpenCode CLI directly

  19. ni3dre commented on Aug 19, 2026

    @ni3dre

    How to Restore Archived Chats in OpenCode
    If you accidentally archived a chat and can't find it anywhere — don't worry, your data is not deleted. OpenCode stores all sessions in a SQLite database, and archiving simply sets a timestamp in the time_archived column. The chat data is still there, just hidden from the UI.

    The Problem
    OpenCode currently has no built-in way to list or restore archived sessions. So when you hit that archive button by mistake, there's no obvious way to get it back. Now enter the following prompt on any chat page:

    The Fix
    Here's a prompt you can paste directly into OpenCode to restore all your archived chats:
    
    My opencode chats disappeared after I accidentally archived them. Please restore them from the SQLite database.
    
    1. Connect to the database at ~/.local/share/opencode/opencode.db using Python's sqlite3 module
    2. List all archived sessions by running: SELECT id, title, datetime(time_created/1000, 'unixepoch', 'localtime') as created, datetime(time_archived/1000, 'unixepoch', 'localtime') as archived FROM session WHERE time_archived IS NOT NULL ORDER BY time_archived DESC;
    3. Show me the list of archived sessions with their titles and dates
    4. Restore all of them by setting time_archived = NULL
    5. Verify the restoration was successful
    
    Important: Do not delete anything. Only unarchive by setting time_archived to NULL.
    

    That's all. Now restart OpenCode.

  20. fabiovaldez commented on Sep 3, 2026

    @fabiovaldez

    This worked for me:
    My archived OpenCode chat sessions are missing from the sidebar. They are stored in the SQLite database at ~/.local/share/opencode/opencode.db in the session table. The column time_archived is set to a timestamp when a session is archived. To restore them, set time_archived = NULL. Please run a query to show me all archived sessions, ask me which one to restore, and then run the UPDATE query to fix it

    When he asked me which session I wanted to restore, I said "restore all of them" and voilà!

    Also, don't forget to remove the shortcut in Settings > Shortcuts > Archive session, just click on the keys binding and press delete.

    Image
  21. GrumpyEqualTrue commented on Sep 18, 2026

    @GrumpyEqualTrue

    The SQLite "solution" did not work for me. Even after updating the entire table and setting the "time_archived" to NULL for all rows, I still can't see them in OpenCode. This is idiotic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

webRelates to opencode on web / desktop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions