{"record":{"id":"8a9edb7d09a08f8d","repo":"tailwindlabs/tailwindcss","slug":"the-prefix-resolvedconfig-prefix-is-invalid","errorCode":null,"errorMessage":"The prefix \"${resolvedConfig.prefix}\" is invalid. Prefixes must be lowercase ASCII letters (a-z) only.","messagePattern":"The prefix \"(.+?)\" is invalid\\. Prefixes must be lowercase ASCII letters \\(a-z\\) only\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tailwindcss/src/compat/apply-compat-hooks.ts","lineNumber":376,"sourceCode":"  applyConfigToTheme(designSystem, resolvedUserConfig, replacedThemeKeys)\n  applyKeyframesToTheme(designSystem, resolvedUserConfig)\n\n  registerThemeVariantOverrides(resolvedUserConfig, designSystem)\n  registerScreensConfig(resolvedUserConfig, designSystem)\n  registerContainerCompat(resolvedUserConfig, designSystem)\n\n  // If a prefix has already been set in CSS don't override it\n  if (!designSystem.theme.prefix && resolvedConfig.prefix) {\n    if (resolvedConfig.prefix.endsWith('-')) {\n      resolvedConfig.prefix = resolvedConfig.prefix.slice(0, -1)\n\n      console.warn(\n        `The prefix \"${resolvedConfig.prefix}\" is invalid. Prefixes must be lowercase ASCII letters (a-z) only and is written as a variant before all utilities. We have fixed up the prefix for you. Remove the trailing \\`-\\` to silence this warning.`,\n      )\n    }\n\n    if (!IS_VALID_PREFIX.test(resolvedConfig.prefix)) {\n      throw new Error(\n        `The prefix \"${resolvedConfig.prefix}\" is invalid. Prefixes must be lowercase ASCII letters (a-z) only.`,\n      )\n    }\n\n    designSystem.theme.prefix = resolvedConfig.prefix\n  }\n\n  // If an important strategy has already been set in CSS don't override it\n  if (!designSystem.important && resolvedConfig.important === true) {\n    designSystem.important = true\n  }\n\n  if (typeof resolvedConfig.important === 'string') {\n    let wrappingSelector = resolvedConfig.important\n\n    walk(ast, (node, _ctx) => {\n      if (node.kind !== 'at-rule') return\n      if (node.name !== '@tailwind' || node.params !== 'utilities') return","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/tailwindlabs/tailwindcss/blob/16e94cbf7f965c5ad697e90e940b5e178efad67c/packages/tailwindcss/src/compat/apply-compat-hooks.ts#L358-L394","documentation":"Thrown when validating a prefix from JS config against `IS_VALID_PREFIX = /^[a-z]+$/`. After automatically trimming a trailing `-` (with a warning), if the remaining prefix contains anything other than lowercase a-z (digits, uppercase, symbols), it is rejected. The prefix is only set once, when `designSystem.theme.prefix` is not already populated from CSS.","triggerScenarios":"Setting `prefix: 'Tw'`, `prefix: 'tw2'`, `prefix: 't_w'`, or `prefix: 't.w'` in `tailwind.config.js`. Each fails the regex after the trailing-dash fixup.","commonSituations":"Using a brand-style prefix with mixed case or numbers; migrating a v3 prefix that contained disallowed characters; misreading the docs as allowing any string.","solutions":["Change the prefix to lowercase ASCII letters only, e.g. `prefix: 'tw'`.","If you need a numeric or mixed-case namespace, use CSS layering or build-time class renaming outside Tailwind's prefix feature.","Re-run after removing any trailing `-` to silence the related warning."],"exampleFix":"// before (tailwind.config.js)\nmodule.exports = { prefix: 'Tw2-' }\n// after\nmodule.exports = { prefix: 'tw' }","handlingStrategy":"validation","validationCode":"const IS_VALID_PREFIX = /^[a-z]+$/;\nfunction assertValidPrefix(prefix) {\n  let p = prefix.endsWith('-') ? prefix.slice(0, -1) : prefix;\n  if (!IS_VALID_PREFIX.test(p)) throw new Error(`Invalid prefix: ${prefix}`);\n}\n// assertValidPrefix(config.prefix);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict prefixes to `^[a-z]+$` at authoring time.","Add a config-schema check (zod/json-schema) validating `prefix` before build."],"tags":["tailwind","prefix","config","validation"],"backgroundTag":null,"analyzedSha":"16e94cbf7f965c5ad697e90e940b5e178efad67c","analyzedAt":"2026-08-12T06:02:42.469Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}