Skip to content

[BUG]: Desktop app shows ConfigInvalidError and no sessions in sidebar after upgrade #33938

Closed as not planned

Description

@pjzzzz

Description

After upgrading to OpenCode Desktop v1.17.11, the app shows ConfigInvalidError at startup in renderer.log. The sidebar shows no projects (or a partial list), even though sessions exist in the SQLite database. This affects non-git directories on Windows.

Root Cause

Two separate issues combine to cause this:

1. variant: null in workspace .dat files causes ConfigInvalidError

The workspace .dat files (%APPDATA%\ai.opencode.desktop\opencode.workspace.*.dat) store session model selection as JSON strings in workspace:model-selection. Some entries contain "variant": null:

"workspace:model-selection": "{\"session\":{\"ses_xxx\":{\"agent\":\"build\",\"model\":{\"modelID\":\"big-pickle\",\"providerID\":\"opencode\"},\"variant\":null}}}"

The renderer process validates this JSON against a schema that rejects null for the variant field — the field is optional (some sessions don't have it at all), but null is not a valid value. This causes ConfigInvalidError in the Electron renderer at startup.

Other sessions in the same .dat files have no variant field at all and work fine:

"ses_yyy":{"agent":"build","model":{"providerID":"opencode","modelID":"big-pickle"}}

2. Missing project entries in opencode.global.dat sidebar list

The opencode.global.dat file contains server.projects.local[] — the list of projects shown in the desktop sidebar. After migration, this list can be incomplete. Directories with sessions but no sidebar entry will not appear, making those sessions invisible in the UI.

Environment

  • OpenCode version: Desktop v1.17.11 (Electron)
  • OS: Windows 10/11
  • Terminal: N/A (desktop app)
  • Repository: Non-git directory (project_id = 'global')

Steps to Reproduce

  1. Use OpenCode Desktop with multiple non-git project directories
  2. Have sessions with "variant": null stored in workspace .dat files
  3. Launch the desktop app
  4. Observe ConfigInvalidError in %APPDATA%\ai.opencode.desktop\logs\<timestamp>\renderer.log
  5. Observe missing projects in the sidebar

Impact

  • Sessions become inaccessible from the desktop UI
  • ConfigInvalidError spams the renderer log (5 occurrences at startup)
  • User must manually edit .dat files to recover access

Workaround / Fix

Fix 1: Remove variant: null from workspace .dat files

Edit each affected opencode.workspace.*.dat file in %APPDATA%\ai.opencode.desktop\:

  1. Locate entries with "variant":null in the workspace:model-selection JSON string
  2. Remove ,"variant":null from each session entry
  3. Ensure the resulting JSON is valid

Example fix:

// Before:
"ses_xxx":{"agent":"build","model":{"modelID":"big-pickle","providerID":"opencode"},"variant":null}

// After:
"ses_xxx":{"agent":"build","model":{"modelID":"big-pickle","providerID":"opencode"}}

Fix 2: Add missing projects to sidebar list

Edit opencode.global.dat in %APPDATA%\ai.opencode.desktop\:

  1. Parse the server JSON string
  2. Add entries to server.projects.local[] for any directory that has sessions but is not listed
  3. Each entry: {"worktree": "C:\\path\\to\\project", "expanded": true}
  4. Restart the desktop app

Additional Notes

  • The workspace table and workspace_id column are not involved — the desktop app loads sessions by project_id and directory, not by workspace_id. All 124 sessions in our DB have workspace_id = NULL (from migration 20260604172448 per issue bug: migration 20260604172448 deletes entire event log for all users on next release #30963), but this does not affect the desktop app.
  • The CLI/TUI does not have this issue — only the Electron desktop app's renderer process validates the .dat file schema strictly.
  • All sessions have project_id = 'global' (non-git directories) — this is expected and correct.
  • event table and message table are intact — no data loss despite the migration.

Related Issues

Plugins

none

OpenCode version

Desktop v1.17.11 (Electron)

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Jun 25, 2026

    @github-actions
    Contributor

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

    If your issue is distinct from the above (e.g. specifically about variant: null schema rejection), please add a note clarifying how it differs.

  2. pjzzzz commented on Jun 25, 2026

    @pjzzzz
    Author

    How This Differs From Similar Issues

    Issue Focus Difference from this report
    #28477 Desktop stops showing sessions until .dat files are cleared Describes clearing .dat files as workaround, but does not identify variant: null as the specific schema rejection causing ConfigInvalidError. This report provides the exact root cause: variant: null is invalid in the renderer's JSON schema validator.
    #17765 Windows Desktop loses session history after restart Describes the symptom (sessions in DB but invisible in UI) but blames it on session data loss. This report shows the data is not lost — the issue is the renderer rejecting workspace config files due to schema validation.
    #31148 Linux Desktop — GPU crash + ConfigInvalidError Linux-specific GPU/compositor crash that also triggers ConfigInvalidError. The root cause is different from variant: null on Windows.

    Related Issues

  3. changed the title [-]Desktop app shows ConfigInvalidError and no sessions in sidebar after upgrade[/-] [+][BUG]: Desktop app shows ConfigInvalidError and no sessions in sidebar after upgrade[/+] on Jun 25, 2026
  4. pjzzzz commented on Jun 25, 2026

    @pjzzzz
    Author

    OpenCode Issue #33938 — ConfigInvalidError and missing sidebar projects

    Findings after recovery (2026-06-25)

    1. variant:null confirmed

    The variant:null bug in workspace .dat files was found in a non-git project: "workspace:model-selection": "{"session":{"ses_xxx":
    {"agent":"build","model":{"providerID":"opencode","modelID":"big-pickle"},
    "variant":null}}}"

    Fix: Remove "variant":null from the JSON string — the session works without ConfigInvalidError afterwards.

    2. Missing sidebar projects reproducible

    The working opencode.global.dat (122KB) contained 5 projects in server.projects.local[]. The broken version (15KB) had only 1 project — the rest had disappeared. All sessions in the SQLite database were intact.

    Fix: Restored working backup global.dat + all workspace .dat files from the same backup.

    3. Workspace .dat file consistency is critical

    Restoring only global.dat is not enough — the workspace .dat files contain session-specific data (model-selection, prompts, followup state) that must be consistent with the session IDs in global.dat.

    The backup had 8 workspace .dat files, the live state had 10 (2 created after the backup). After restore both matched.

    4. Recovery process

    Restored via a manual script (outside OpenCode Desktop):

    1. Stop OpenCode Desktop (taskkill /f /im OpenCode.exe)
    2. Copy backup global.dat + 8 workspace .dat files to %APPDATA%\ai.opencode.desktop\
    3. Restart OpenCode Desktop
    4. Sidebar showed all 5 projects ✅

    5. Recommendations for OpenCode Desktop

    • variant:null validation: The schema validator in the renderer should accept null for optional fields, or the backend should strip variant: null during serialization.
    • Sidebar project list sync: If a project directory exists and contains sessions but is missing from server.projects.local[], the app should auto-add it, or at least provide a "scan for missing projects" button.
    • Graceful degradation on ConfigInvalidError: A session with invalid data should not block the entire startup. Show a warning for that specific session instead of a ConfigInvalidError that breaks the sidebar.
    • Logging: The ConfigInvalidError appears in renderer.log but is invisible to end users. Consider a badge or notification in the UI.
  5. StarDreamG commented on Jul 1, 2026

    @StarDreamG

    I can reproduce a very similar Desktop sidebar/project loss on macOS with Desktop v1.17.12.

    Environment:

    • OpenCode Desktop: v1.17.12

    • OS: macOS, Apple Silicon

    • Plugins: none

    • Config only contains one local MCP server (codegraph)

    • CLI is not installed (opencode: command not found), Desktop only

    Observed behavior:

    • After first launch/restart on v1.17.12, the Desktop sidebar no longer shows previous projects/sessions.

    • Chat/session data is not lost.

    • Removing/renaming ~/Library/Application Support/ai.opencode.desktop/opencode.global.dat and opencode.workspace*.dat did not rebuild the sidebar/project UI correctly; it also cleared the remaining UI project list.

    SQLite checks:

    sqlite3 ~/.local/share/opencode/opencode.db "select count(*) from session;"
    
    # 17
    
    sqlite3 ~/.local/share/opencode/opencode.db ".schema project"
    
    # project has id, worktree, vcs, name, icon_url, icon_color,
    
    # time_created, time_updated, time_initialized, sandboxes,
    
    # commands, icon_url_override
    
    sqlite3 ~/.local/share/opencode/opencode.db "select id, worktree, vcs, icon_color from project;"
    
    # global | / | ...
    
    # <sha> | /Users/<user>/personal/contextGraph | git | orange
    
    # <sha> | /Users/<user>/xh-project-first       | git | pink
    
    # <sha> | /Users/<user>/yiqi                   | git | mint
    
    # <sha> | /Users/<user>/4A_Dashboard           | git | lime
    
    # <sha> | /Users/<user>/FirefightingAgent      | git | cyan
    
    sqlite3 ~/.local/share/opencode/opencode.db "select * from workspace;"
    
    # empty
    
    ls -R ~/.local/share/opencode/repos
    
    # empty
    
    
    opencode.global.dat is valid JSON. Before reset, globalSync.project only contained the root project:
    
    {"value":[{"id":"global","worktree":"/","sandboxes":[]}]}
    
    But the same file still had notification history referencing the real project directories and session ids, so this looks like a Desktop sidebar/project hydration problem rather than data loss.
    
    This looks related to the missing server.projects.local[] / Desktop sidebar project list behavior described above. In my case, the SQLite project table is populated and sessions exist, but Desktop does not reconstruct or display the project/session sidebar from that state.
  6. github-actions commented on Aug 31, 2026

    @github-actions
    Contributor

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

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