Skip to content

opentui: fatal: undefined is not an object (evaluating 'c3[mode2]') using a custom theme that worked in 0.15.31 #4368

Closed

Description

@ariane-emory

Description

This error is a regression in comparison to 0.15.31, and occurs when using a custom theme that used to work properly in that version. The custom theme in question is included at the end.

TypeError: undefined is not an object (evaluating 'c3[mode2]')
    at resolveColor (src/cli/cmd/tui/context/theme.tsx:69:25)
    at <anonymous> (src/cli/cmd/tui/context/theme.tsx:72:18)
    at map (native:1:11)
    at resolveTheme (src/cli/cmd/tui/context/theme.tsx:71:57)
    at runComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:724:3)
    at readSignal (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:660:67)
    at get (src/cli/cmd/tui/context/theme.tsx:111:18)
    at <anonymous> (src/cli/cmd/tui/app.tsx:531:17)
    at runComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:724:3)
    at createRenderEffect (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:240:75)
    at <anonymous> (src/cli/cmd/tui/app.tsx:517:5)
    at untrack (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:475:12)
    at runComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:724:3)
    at devComponent (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:593:3)
    at children (src/cli/cmd/tui/context/helper.tsx:18:24)
    at <anonymous> (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:1057:29)
    at runComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:724:3)
    at createMemo (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:273:10)
    at children (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:616:20)
    at untrack (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:475:12)
    at <anonymous> (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:1052:36)
    at runComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:724:3)
    at createRenderEffect (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:240:75)
    at provider (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:1052:5)
    at untrack (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:475:12)
    at runComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:724:3)
    at devComponent (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:593:3)
    at <anonymous> (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:1532:21)
    at runComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:724:3)
    at createMemo (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:273:10)
    at untrack (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:475:12)
    at runComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:724:3)
    at devComponent (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:593:3)
    at untrack (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:475:12)
    at runComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:724:3)
    at devComponent (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:593:3)
    at children (src/cli/cmd/tui/component/dialog-command.tsx:88:14)
    at <anonymous> (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:1057:29)
    at runComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:724:3)
    at createMemo (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:273:10)
    at children (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:616:20)
    at untrack (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:475:12)
    at <anonymous> (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:1052:36)
    at runComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:724:3)
    at createRenderEffect (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:240:75)
    at provider (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:1052:5)
    at untrack (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:475:12)
    at runComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:742:22)
    at updateComputation (../../node_modules/.bun/[email protected]/node_modules/solid-js/dist/dev.js:724:3)
    at devComponent (../../node_modules/.bun/[email protected]...

Custom theme file contents:

{
  "$schema": "https://opencode.ai/theme.json",
  "defs": {
    "dark_bg": "#161617",
    "dark_fg": "#c9c7cd",
    "dark_bg_dark": "#131314",

    "dark_black": "#27272a",
    "dark_red": "#f5a191",
    "dark_green": "#90b99f",
    "dark_yellow": "#e6b99d",
    "dark_blue": "#aca1cf",
    "dark_magenta": "#e29eca",
    "dark_cyan": "#ea83a5",
    "dark_white": "#c1c0d4",

    "dark_bright_black": "#353539",
    "dark_bright_red": "#ffae9f",
    "dark_bright_green": "#9dc6ac",
    "dark_bright_yellow": "#f0c5a9",
    "dark_bright_blue": "#b9aeda",
    "dark_bright_magenta": "#ecaad6",
    "dark_bright_cyan": "#f591b2",
    "dark_bright_white": "#cac9dd",

    "dark_gray00": "#18181a",
    "dark_gray01": "#1b1b1d",
    "dark_gray02": "#2a2a2d",
    "dark_gray03": "#3e3e43",
    "dark_gray04": "#57575f",
    "dark_gray05": "#757581",
    "dark_gray06": "#9998a8",
    "dark_gray07": "#c1c0d4"
  },
  "theme": {
    "primary": "dark_cyan",
    "secondary": "dark_cyan",
    "accent": "dark_blue",
    "error": "dark_cyan",
    "warning": "dark_yellow",
    "success": "dark_green",
    "info": "dark_blue",
    "text": "dark_fg",
    "textMuted": "dark_white",
    "background": "none",
    "backgroundPanel": "dark_gray01",
    "backgroundElement": "dark_gray02",
    "border": "dark_gray02",
    "borderActive": "dark_gray01",
    "borderSubtle": "dark_gray00",
    "diffAdded": "dark_black",
    "diffRemoved": "dark_black",
    "diffContext": "dark_fg",
    "diffHunkHeader": "dark_magenta",
    "diffHighlightAdded": "dark_bright_green",
    "diffHighlightRemoved": "dark_bright_red",
    "diffAddedBg": "dark_green",
    "diffRemovedBg": "dark_red",
    "diffContextBg": "dark_gray00",
    "diffLineNumber": "diffContextBg",
    "diffAddedLineNumberBg": "dark_green",
    "diffRemovedLineNumberBg": "dark_red",
    "markdownText": "dark_fg",
    "markdownHeading": "dark_gray06",
    "markdownLink": "dark_blue",
    "markdownLinkText": "dark_cyan",
    "markdownCode": "dark_bright_green",
    "markdownBlockQuote": "dark_gray00",
    "markdownEmph": "dark_bright_yellow",
    "markdownStrong": "dark_bright_red",
    "markdownHorizontalRule": "markdownText",
    "markdownListItem": "dark_blue",
    "markdownListEnumeration": "dark_bright_blue",
    "markdownImage": "markdownLink",
    "markdownImageText": "markdownLinkText",
    "markdownCodeBlock": "dark_fg",
    "syntaxComment": "dark_gray05",
    "syntaxKeyword": "dark_blue",
    "syntaxFunction": "dark_gray07",
    "syntaxVariable": "dark_fg",
    "syntaxString": "dark_green",
    "syntaxNumber": "dark_magenta",
    "syntaxType": "dark_magenta",
    "syntaxOperator": "dark_yellow",
    "syntaxPunctuation": "dark_gray06"
  }
}

OpenCode version

1.0.67

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

MacOS latest Sequoia

Terminal

iTerm2

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 16, 2025
  2. github-actions commented on Nov 16, 2025

    @github-actions
    Contributor

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

    The error 'undefined is not an object (evaluating 'c3[mode2]')' appears to be a known regression in theme handling for custom themes, especially those using "none" values or non-standard color definitions that worked in 0.15.31.

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

  3. OpeOginni commented on Nov 17, 2025

    @OpeOginni
    Contributor

    @ariane-emory The issue seems to be the fact you are reusing specific theme keys, as the values for other ones.

    For example

        "diffContextBg": "dark_gray00",
        "diffLineNumber": "diffContextBg", // This should be a def not a repeat of a theme key

    You make this mistake 4 places

        "markdownHorizontalRule": "markdownText",
        "markdownImage": "markdownLink",
        "markdownImageText": "markdownLinkText",

    Change them to actual color defs and it works. Tried that in my end, with the one below

    Working Theme
    {
        "$schema": "https://opencode.ai/theme.json",
        "defs": {
          "dark_bg": "#161617",
          "dark_fg": "#c9c7cd",
          "dark_bg_dark": "#131314",
      
          "dark_black": "#27272a",
          "dark_red": "#f5a191",
          "dark_green": "#90b99f",
          "dark_yellow": "#e6b99d",
          "dark_blue": "#aca1cf",
          "dark_magenta": "#e29eca",
          "dark_cyan": "#ea83a5",
          "dark_white": "#c1c0d4",
      
          "dark_bright_black": "#353539",
          "dark_bright_red": "#ffae9f",
          "dark_bright_green": "#9dc6ac",
          "dark_bright_yellow": "#f0c5a9",
          "dark_bright_blue": "#b9aeda",
          "dark_bright_magenta": "#ecaad6",
          "dark_bright_cyan": "#f591b2",
          "dark_bright_white": "#cac9dd",
      
          "dark_gray00": "#18181a",
          "dark_gray01": "#1b1b1d",
          "dark_gray02": "#2a2a2d",
          "dark_gray03": "#3e3e43",
          "dark_gray04": "#57575f",
          "dark_gray05": "#757581",
          "dark_gray06": "#9998a8",
          "dark_gray07": "#c1c0d4"
        },
        "theme": {
          "primary": "dark_cyan",
          "secondary": "dark_cyan",
          "accent": "dark_blue",
          "error": "dark_cyan",
          "warning": "dark_yellow",
          "success": "dark_green",
          "info": "dark_blue",
          "text": "dark_fg",
          "textMuted": "dark_white",
          "background": "none",
          "backgroundPanel": "dark_gray01",
          "backgroundElement": "dark_gray02",
          "border": "dark_gray02",
          "borderActive": "dark_gray01",
          "borderSubtle": "dark_gray00",
          "diffAdded": "dark_black",
          "diffRemoved": "dark_black",
          "diffContext": "dark_fg",
          "diffHunkHeader": "dark_magenta",
          "diffHighlightAdded": "dark_bright_green",
          "diffHighlightRemoved": "dark_bright_red",
          "diffAddedBg": "dark_green",
          "diffRemovedBg": "dark_red",
          "diffContextBg": "dark_gray00",
          "diffLineNumber": "dark_gray00",
          "diffAddedLineNumberBg": "dark_green",
          "diffRemovedLineNumberBg": "dark_red",
          "markdownText": "dark_fg",
          "markdownHeading": "dark_gray06",
          "markdownLink": "dark_blue",
          "markdownLinkText": "dark_cyan",
          "markdownCode": "dark_bright_green",
          "markdownBlockQuote": "dark_gray00",
          "markdownEmph": "dark_bright_yellow",
          "markdownStrong": "dark_bright_red",
          "markdownHorizontalRule": "dark_fg",
          "markdownListItem": "dark_blue",
          "markdownListEnumeration": "dark_bright_blue",
          "markdownImage": "dark_blue",
          "markdownImageText": "dark_cyan",
          "markdownCodeBlock": "dark_fg",
          "syntaxComment": "dark_gray05",
          "syntaxKeyword": "dark_blue",
          "syntaxFunction": "dark_gray07",
          "syntaxVariable": "dark_fg",
          "syntaxString": "dark_green",
          "syntaxNumber": "dark_magenta",
          "syntaxType": "dark_magenta",
          "syntaxOperator": "dark_yellow",
          "syntaxPunctuation": "dark_gray06"
        }
      }
  4. ariane-emory commented on Nov 17, 2025

    @ariane-emory
    ContributorAuthor

    That does sound like it should be an effective workaround for the moment, I'll try it out. Thank you very much for providing your modified version of the theme.

    Nonetheless, this is still a regression: the version of the theme I had pasted did work properly in 0.15.31.

  5. self-assigned this
    on Nov 17, 2025
  6. OpeOginni commented on Nov 17, 2025

    @OpeOginni
    Contributor

    @ariane-emory I can check it out then, and see what changes caused it

  7. OpeOginni commented on Nov 17, 2025

    @OpeOginni
    Contributor

    @rekram1-node I have a branch ready to fix this, making the old configs work, okay with me making a PR?

  8. rekram1-node commented on Nov 18, 2025

    @rekram1-node
    Collaborator

    @OpeOginni sure thing

  9. rekram1-node commented on Nov 18, 2025

    @rekram1-node
    Collaborator

    fixed by @OpeOginni in next release

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions