{"record":{"id":"8b53552c329a408f","repo":"tailwindlabs/tailwindcss","slug":"utility-node-params-defines-an-invalid-utili-8b5355","errorCode":null,"errorMessage":"`@utility ${node.params}` defines an invalid utility name. Utilities should be alphanumeric and start with a lowercase letter.","messagePattern":"`@utility (.+?)` defines an invalid utility name\\. Utilities should be alphanumeric and start with a lowercase letter\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tailwindcss/src/index.ts","lineNumber":249,"sourceCode":"          `\\`@utility ${node.params}\\` is empty. Utilities should include at least one property.`,\n        )\n      }\n\n      let utility = createCssUtility(node)\n      if (utility === null) {\n        if (!node.params.endsWith('-*')) {\n          if (node.params.endsWith('*')) {\n            throw new Error(\n              `\\`@utility ${node.params}\\` defines an invalid utility name. A functional utility must end in \\`-*\\`.`,\n            )\n          } else if (node.params.includes('*')) {\n            throw new Error(\n              `\\`@utility ${node.params}\\` defines an invalid utility name. The dynamic portion marked by \\`-*\\` must appear once at the end.`,\n            )\n          }\n        }\n\n        throw new Error(\n          `\\`@utility ${node.params}\\` defines an invalid utility name. Utilities should be alphanumeric and start with a lowercase letter.`,\n        )\n      }\n\n      customUtilities.push(utility)\n    }\n\n    // Collect paths from `@source` at-rules\n    if (node.name === '@source') {\n      if (node.nodes.length > 0) {\n        throw new Error('`@source` cannot have a body.')\n      }\n\n      if (ctx.parent !== null) {\n        throw new Error('`@source` cannot be nested.')\n      }\n\n      let not = false","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/tailwindlabs/tailwindcss/blob/16e94cbf7f965c5ad697e90e940b5e178efad67c/packages/tailwindcss/src/index.ts#L231-L267","documentation":"Terminal fallback in the `createCssUtility === null` chain: the params contain no offending `*` placement but still fail the strict utility-name validation (start with a lowercase letter, alphanumeric + dashes). Typical offenders: leading uppercase, leading digit, embedded spaces, or disallowed characters.","triggerScenarios":"Naming a utility `@utility Foo`, `@utility 3col`, `@utility foo bar`, `@utility foo_bar`, or `@utility foo-*-*` (the last ends with `-*` so it bypasses the `*` checks and lands here because the double wildcard is invalid).","commonSituations":"Importing BEM/kebab-snake names that use underscores; capitalizing utility names by convention; copy-paste that introduces a space or stray character.","solutions":["Rename to start with a lowercase letter and use only `a-z0-9-`: `@utility foo-bar`.","Replace underscores with dashes: `foo_bar` → `foo-bar`.","For functional utilities keep exactly one trailing `-*`: `icon-*` (not `icon-*-*`)."],"exampleFix":"/* before */\n@utility Card_Primary { ... }\n\n/* after */\n@utility card-primary { ... }","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Full utility-name guard covering the terminal fallback.\n// Static: lowercase letter, then alphanumerics/dashes. Functional: same, plus single trailing -*.\nconst STATIC_UTILITY = /^[a-z][a-zA-Z0-9-]*$/\nconst FUNCTIONAL_UTILITY = /^[a-z][a-zA-Z0-9-]*-\\*$/\n\nfunction isValidUtilityName(name: string): boolean {\n  return STATIC_UTILITY.test(name) || FUNCTIONAL_UTILITY.test(name)\n}","tryCatchPattern":null,"preventionTips":["Adopt kebab-case starting with a lowercase letter for every utility name.","Reject underscores, spaces, and uppercase in code review.","Avoid multi-wildcard names like `-*-*` — split into separate utilities."],"tags":["at-utility","naming","validation"],"backgroundTag":null,"analyzedSha":"16e94cbf7f965c5ad697e90e940b5e178efad67c","analyzedAt":"2026-08-12T06:02:42.469Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}