{"record":{"id":"1f23b4d336a3712e","repo":"tailwindlabs/tailwindcss","slug":"invalid-theme-value-value-for-namespace-ke","errorCode":null,"errorMessage":"Invalid theme value `${value}` for namespace `${key}`","messagePattern":"Invalid theme value `(.+?)` for namespace `(.+?)`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tailwindcss/src/theme.ts","lineNumber":63,"sourceCode":"    private values = new Map<\n      string,\n      {\n        value: string\n        options: ThemeOptions\n        src: Declaration['src']\n      }\n    >(),\n    private keyframes = new Set<AtRule>([]),\n  ) {}\n\n  get size() {\n    return this.values.size\n  }\n\n  add(key: string, value: string, options = ThemeOptions.NONE, src?: Declaration['src']): void {\n    if (key.endsWith('-*')) {\n      if (value !== 'initial') {\n        throw new Error(`Invalid theme value \\`${value}\\` for namespace \\`${key}\\``)\n      }\n      if (key === '--*') {\n        this.values.clear()\n      } else {\n        this.clearNamespace(\n          key.slice(0, -2),\n          // `--${key}-*: initial;` should clear _all_ theme values\n          ThemeOptions.NONE,\n        )\n      }\n    }\n\n    if (options & ThemeOptions.DEFAULT) {\n      let existing = this.values.get(key)\n      if (existing && !(existing.options & ThemeOptions.DEFAULT)) return\n    }\n\n    if (value === 'initial') {","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/tailwindlabs/tailwindcss/blob/16e94cbf7f965c5ad697e90e940b5e178efad67c/packages/tailwindcss/src/theme.ts#L45-L81","documentation":"Thrown by Theme.add() when a namespace-clearing key (one ending in '-*', e.g. '--color-*' or '--*') is paired with a value other than the literal string 'initial'. In Tailwind v4's @theme block, a trailing '-*' declares intent to clear an entire namespace, and 'initial' is the only legal value for that operation. Any other value is treated as a malformed clear directive.","triggerScenarios":"Writing CSS like `@theme { --color-*: red; }` (clearing syntax with a non-initial value), or programmatically calling theme.add('--color-*', 'blue'). Also fires for `--*` (the global clear) with any value besides 'initial'. The check at theme.ts:62 runs before the namespace is actually cleared, so the theme map is left untouched.","commonSituations":"Mistaking the namespace-clear syntax for a wildcard setter (expecting '--color-*: red' to set every color to red). Copying a CSS reset pattern from elsewhere. Upgrading from v3 where theme keys behaved differently and assuming '-*' is a glob assignment.","solutions":["If you intend to clear the namespace, use the literal value 'initial': `--color-*: initial;`","If you intend to set specific values, list each key explicitly: `--color-red-500: #f87171;` instead of using the '-*' wildcard.","If you want to replace every color, clear with '--color-*: initial;' first, then declare the new individual values below it."],"exampleFix":"/* before — throws */\n@theme {\n  --color-*: #f00;\n}\n\n/* after — clears, then sets */\n@theme {\n  --color-*: initial;\n  --color-primary: #f00;\n}","handlingStrategy":"validation","validationCode":"// Before calling theme.add with a namespace key\nfunction isNamespaceClear(key: string, value: string): boolean {\n  return key.endsWith('-*') && value !== 'initial'\n}\nif (isNamespaceClear(key, value)) {\n  throw new Error(`Namespace key '${key}' requires value 'initial', got '${value}'`)\n}\ntheme.add(key, value)","typeGuard":"function isLegalNamespaceValue(key: string, value: string): boolean {\n  return !key.endsWith('-*') || value === 'initial'\n}","tryCatchPattern":null,"preventionTips":["Treat '-*' suffix in @theme as a clear directive, never a wildcard setter.","Always pair namespace-clear keys with the literal value 'initial'.","When building theme keys programmatically, reject or rewrite '-*' keys unless the value is 'initial'."],"tags":["tailwindcss","theme","css","configuration","v4"],"backgroundTag":null,"analyzedSha":"16e94cbf7f965c5ad697e90e940b5e178efad67c","analyzedAt":"2026-08-12T06:02:42.469Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}