Skip to content

Edit Project: icon/color changes not persisted to database for projects without independent records #37345

Closed as duplicate

Description

@yiyinideshang

Description

When editing a project's icon or color through the Edit Project modal in the Desktop app, the changes are not saved to the project table in the SQLite database if the project does not have an independent record (i.e., its id is "global" or empty). The data is written only to the local workspace file (opencode.workspace.*.dat), which the sidebar does not read for display purposes. As a result, the user sees no visual change in the sidebar after saving.

I dug into the app.asar and found this in the save handler:

if (props.project.id && props.project.id !== "global") {
  // Has independent DB record → writes to `project` table
  await serverCtx().sdk.client.project.update({...});
} else {
  // No independent DB record → writes only to workspace file
  serverCtx().sync.project.meta(props.project.worktree, {...});
}

Projects that don't yet have an independent record in the project table (those falling back to the global row) always take the else branch. The resulting data is stored in opencode.workspace.*.dat — but the sidebar rendering layer does not read icon/color metadata from workspace files. It reads from the project table. Therefore, any changes are invisible.

Only projects that already have an independent row in the project table (e.g., created in earlier OpenCode versions before this behavior was introduced) will persist icon/color changes correctly.

Steps to Reproduce

  1. Open OpenCode Desktop on a workspace-style project that does not have its own row in the project table (most projects fall into this category).
  2. Click the project name → Edit Project.
  3. Change the project icon and/or accent color → Save.

Observe: the sidebar icon and color do not update.
Expected Behavior Editing a project's icon or color should persist to the database (or the sidebar should be updated to read from workspace files) so that the change is immediately visible in the sidebar.

Workaround Directly manipulate the SQLite database:

  • Database: opencode.db → project table

  • UPDATE project SET icon_url = NULL, color = NULL WHERE id = 'global';

  • After restarting the app, the sidebar will reflect the database values.

My Environment

OpenCode Desktop version: 1.18.3;
OS: Windows

Activity

  1. github-actions commented on Jul 16, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The description appears to be AI-generated (highly structured, formal language, reverse-engineered code with precise variable names from bundled output, Option A/B fix framing). Long, AI-generated walls of text are not acceptable per our contributing guidelines. Please rewrite this in your own words describing what you actually observed.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


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

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. github-actions commented on Jul 16, 2026

    @github-actions
    Contributor

    Thank you for updating the issue! The description is now clear and specific, with steps to reproduce and environment info. The needs:compliance label has been removed. We appreciate you taking the time to revise it.

  3. cgartlab commented on Aug 12, 2026

    @cgartlab

    Hi @yiyinideshang, I'm experiencing a very similar "Edit Project save not taking effect" issue, and I'd like to add a reproduction from a different runtime mode and platform that may help isolate the root cause.

    Environment

    • OpenCode version: 1.18.15 (npm global, opencode-ai@1.18.15)
    • Plugin version: @opencode-ai/plugin@1.16.2
    • OS: Windows 11 25H2 (build 26200)
    • Browser: Microsoft Edge (Chromium)
    • Runtime mode: opencode web (web UI, not the Desktop Electron client)
    • Project type: Local directory project already present in the opencode project list, without an independent project table record (likely falling back to the global row)
    • Local config: Multiple providers (deepseek, minimax, nvidia, sensenova, etc.), plugins oh-my-opencode-slim + TUI plugin. Storage: ~/.local/share/opencode/opencode.db (SQLite, WAL mode).

    Steps to reproduce

    1. Start with opencode web and open the web UI.
    2. Right-click the target project in the project list -> Edit Project.
    3. Change the project name to a new value and click Save.
    4. Re-open the dialog - the name has reverted to the original value.

    The icon/color shows the same behavior: selecting a new accent color -> Save -> reopen dialog shows no selection / reverts to default.

    Relation to the analysis in this issue

    The save-branch logic described here - if (props.project.id && id !== "global") { ...project.update(...) } else { sync.project.meta(worktree, {...}) } - matches my observation closely: my project falls into the "no independent project table record, falls back to global row" category, so it takes the else branch and writes to the workspace .dat file rather than the project table in opencode.db.

    I can also confirm the three points raised in #32691:

    • No error is surfaced in the UI when saving (consistent with a missing onError on the mutation, silently swallowing API errors).
    • The icon color appears to be submitted as "" rather than an omitted field, resulting in no selected state on the next dialog open.
    • No immediate UI refresh after save, as if relying on a delayed SSE event.

    Why this reproduction is useful

    1. First reported reproduction in opencode web mode. All existing reports in Edit Project: icon/color changes not persisted to database for projects without independent records #37345, Project display name changes ignored in NewLayout (v1.18.x) #38478, and Edit Project dialog name/color changes fail to save properly #32691 come from the Desktop client. If the web UI reproduces it too (as it does here), the root cause lives in the shared backend persistence layer rather than Desktop-specific rendering/sync paths.
    2. Independent confirmation on Windows, ruling out a macOS-only trigger.
    3. My configuration has multiple providers and plugins; reproduction under this setup helps rule out "only reproducible with minimal default config".

    Debug info I can provide (sanitized before sharing)

    • Browser DevTools Network/Console capture of the Save request/response (request body fields, HTTP status, response body - can directly determine whether the backend receives the name/color fields).
    • Sanitized excerpts from opencode.workspace.<hash>.dat and opencode.global.dat.
    • Minimal screenshots of the reproduction, if needed.

    Would it be helpful if I prioritize the Network request logs, to distinguish between "backend received but did not persist" (#37345 direction) versus "request silently failed" (#32691 direction)?

    This also relates to #32691 and #38478; happy to move or consolidate if maintainers prefer a single tracker.

    Thanks to the maintainers for the ongoing fixes, and thanks @yiyinideshang for the detailed analysis.

  4. bacca87 commented on Aug 21, 2026

    @bacca87

    Same issue here on Linux, confirmed on v1.18.21.

    Environment

    • OS: openSUSE Tumbleweed (Linux x86_64)
    • OpenCode Desktop v1.18.21 (installed from opencode-desktop-linux-x86_64.rpm)
    • App data dir: ~/.config/ai.opencode.desktop/

    What happens
    Changing a project color via "Edit Project" saves without any error, but the project list keeps showing the default gray. All projects look identical.

    Evidence (matches this report exactly)

    • ~/.local/share/opencode/opencode.db → table project contains only the global row (worktree="/", empty name, empty icon_color); project_directory is empty. None of my projects have an independent record.
    • ~/.config/ai.opencode.desktop/opencode.workspace.*.dat → the color IS persisted, e.g. "workspace:project":"{\"value\":{\"icon\":{\"color\":\"mint\"},...}}" and another with "green". So the value is written to the workspace file (the else branch), while the sidebar reads from the project table and never shows it.

    So the colors are not lost — they are written to the workspace .dat files but never rendered, same root cause described above. Happy to provide logs or the exact .dat/DB contents if useful.

  5. neriousy commented on Oct 1, 2026

    @neriousy
    Member

    Closing as a duplicate of #32708, which tracks the Edit Project dialog not saving custom icons, colors and names for local projects. Please follow and 👍 there.

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