Skip to content

[BUG]: Error: no such column: name #31119

Closed as not planned
Closed as not planned

Description

@AndrewShear

Description

Background

I haven't used Opencode in some time and coming back to I was asked to update the version. I updated the version and now the app is no longer letting me use it. I receive the image I have provided.

Plugins

No response

OpenCode version

1.16.2

Steps to reproduce

  1. open opencode running version 1.16.2

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

Windows Terminal

Activity

  1. github-actions commented on Jun 6, 2026

    @github-actions
    Contributor

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

  2. hguilla commented on Jun 7, 2026

    @hguilla

    Removing ~/.local/share/opencode/opencode.db solved the issue for me, though I don't care for any previous sessions or data that could have been lost by this. Otherwise, it seems to be related to the issue mentioned and there's a PR with a fix

  3. marked Opencode Tools Error #31379 as a duplicate of this issue on Jun 8, 2026
  4. baoanhng commented on Jun 11, 2026

    @baoanhng

    If on Windows, access %USERPROFILE%\.local\share\ and delete the opencode folder.

  5. ZiFy commented on Jun 18, 2026

    @ZiFy

    same problem on macOS

  6. conetyon commented on Jun 19, 2026

    @conetyon

    如果是Windows,访问并删除opencode文件夹。%USERPROFILE%\.local\share\

    这个好使

  7. optimasupport commented on Jun 20, 2026

    @optimasupport

    How to Fix OpenCode Error: no such column: name (#31119) – Windows Solution
    If you're encountering the following error in OpenCode:

    Error: no such column: name
    #31119

    You can resolve it by resetting the local OpenCode data folder.

    Solution (Windows)
    Press Windows + R.
    Enter the following path and press Enter:
    %USERPROFILE%.local\share
    Delete the opencode folder.
    Restart OpenCode.

    After restarting, OpenCode should recreate the required files and the error should be resolved.

    Image
  8. sapwavino commented on Jun 20, 2026

    @sapwavino

    same problem on macOS

    Any solutions yet?

  9. a-n-d-a-i commented on Jun 24, 2026

    @a-n-d-a-i

    Same issue when running as my agent user with sudo su (or via machinectl), or via SSH.

    Could not run opencode (the cli) nor opencode web.

    opencode caused a systemd coredump, while the web command crashed immediately with the error described in the first post of this issue thread.

    Deleting ~/.local/share/opencode/opencode.db solved it for me.

  10. ssg135 commented on Jul 3, 2026

    @ssg135

    Same issue when running as my agent user with sudo su (or via machinectl), or via SSH.

    Could not run opencode (the cli) nor opencode web.

    opencode caused a systemd coredump, while the web command crashed immediately with the error described in the first post of this issue thread.

    Deleting ~/.local/share/opencode/opencode.db solved it for me.

    Thank you, your method works on Ubuntu 20.04.

  11. kde2podfreebsd commented on Jul 6, 2026

    @kde2podfreebsd

    If u have mac, try this, thats helped for me.

    1. Close opencode
    2. Find database file: for example
    ~/.local/share/opencode/opencode.db
    
    mv ~/.local/share/opencode/opencode.db ~/.local/share/opencode/opencode.db.bak
    
    1. Reopen OpenCode - on open opencode create database with right struct and all will work fine
  12. MoshiLL commented on Jul 17, 2026

    @MoshiLL

    If on Windows, access %USERPROFILE%\.local\sha

    it's useful, thanks

  13. shawnboutilier-tech commented on Jul 17, 2026

    @shawnboutilier-tech

    Any solutions that do not nuke the session DB? I want to continue my sessions. Any SQLite queries I could run?

  14. tianhuil commented on Jul 17, 2026

    @tianhuil

    I'm getting this on OSX?

  15. simonliska commented on Jul 21, 2026

    @simonliska

    Any solutions that do not nuke the session DB? I want to continue my sessions. Any SQLite queries I could run?

    There are multiple PRs open to fully fix the issue, #37707 , #34188 and the closed one #31121.

    For session and message table you can follow manual migration:

    • Move DB
    mv ~/.local/share/opencode/opencode.db ~/.local/share/opencode/opencode.db.bak
    
    • Open/close Opencode to create new DB.
    • Connect to DB:
      sqlite3 ~/.local/share/opencode/opencode.db
    • Check the ID for the project in the old and the new DB (for me it changed):
      SELECT id, worktree, name FROM project;
    • Attach old DB:
      ATTACH DATABASE '.local/share/opencode/opencode.db.bak' AS old;
    • Import the sessions (replace project IDs):
    INSERT INTO session (
      id, project_id, workspace_id, parent_id, slug, directory, path, title, version, share_url,
      summary_additions, summary_deletions, summary_files, summary_diffs, metadata,
      cost, tokens_input, tokens_output, tokens_reasoning, tokens_cache_read, tokens_cache_write,
      revert, permission, agent, model, time_created, time_updated, time_compacting, time_archived
    )
    SELECT
      s.id,
      '<NEW_PROJECT_ID>',
      NULL, s.parent_id, s.slug, s.directory, NULL, s.title, s.version, s.share_url,
      s.summary_additions, s.summary_deletions, s.summary_files, s.summary_diffs, NULL,
      0, 0, 0, 0, 0, 0,
      s.revert, s.permission, NULL, NULL, s.time_created, s.time_updated, s.time_compacting, s.time_archived
    FROM old.session s
    WHERE s.project_id = '<OLD_PROJECT_ID>';
    
    • Import messages (replace project ID):
    INSERT INTO message
    SELECT m.* FROM old.message m
    WHERE m.session_id IN (
      SELECT id FROM old.session WHERE project_id = '<OLD_PROJECT_ID>'
    );
    
    INSERT INTO part
    SELECT p.* FROM old.part p
    WHERE p.session_id IN (
      SELECT id FROM old.session WHERE project_id = '<OLD_PROJECT_ID>'
    );
    
    • You should see sessions and messages restored
    • If you need other tables you need to migrate them
  16. builderjackm commented on Aug 6, 2026

    @builderjackm

    Still reproducible on 1.18.14 (desktop, Electron build) on Windows 11, upgrading from a ~Feb 2026 version.

    Diagnostics from the exported debug bundle:

    • renderer.log: fatal renderer error: Error: no such column: name (at oc://renderer/index.html)
    • utility.log: sidecar exited { code: 1 } — the server process dies immediately on startup, so the renderer has no backend
    • main.log: gets as far as spawning sidecar / awaiting server ready, then nothing

    State of the old database (~/.local/share/opencode/opencode.db):

    • __drizzle_migrations contains only 3 rows, latest created_at = 2026-02-13
    • migration table is empty
    • So the migration path from that era's schema to current appears to be broken — the server queries a name column that doesn't exist yet and exits

    Workaround that worked: delete (or rename) ~/.local/share/opencode/opencode.db and let the app recreate it on next launch. Session history is lost unless manually migrated via the SQL steps above.

    Happy to provide the full debug zip if useful.

  17. alexnotes commented on Aug 6, 2026

    @alexnotes

    for Mac:

    1. mv ~/.local/share/opencode ~/.local/share/opencode_bak
    2. rm -rf ~/.local/share/opencode
    3. restart opencode
  18. Mohammad-R-Rashid commented on Aug 17, 2026

    @Mohammad-R-Rashid

    @alexnotes solution worked on my mac. Issue still exists in the latest update of open code as of Aug 16, 2026.

  19. bgzo commented on Aug 22, 2026

    @bgzo

    Run this DDL:

    DROP TABLE IF EXISTS workspace;
    
    CREATE TABLE `workspace` (
              `id` text PRIMARY KEY,
              `type` text NOT NULL,
              `name` text DEFAULT '' NOT NULL,
              `branch` text,
              `directory` text,
              `extra` text,
              `project_id` text NOT NULL,
              `time_used` integer NOT NULL,
              CONSTRAINT `fk_workspace_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON
    DELETE
        CASCADE
            );
  20. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions