{"record":{"id":"d2bba9013037c4d0","repo":"withastro/astro","slug":"csstransformerrors-0-message","errorCode":null,"errorMessage":"${cssTransformErrors[0].message}","messagePattern":"\\$\\{cssTransformErrors\\[0\\]\\.message\\}","errorType":"exception","errorClass":"AggregateError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/core/compile/compile.ts","lineNumber":119,"sourceCode":"\t\t\tname: 'CompilerError',\n\t\t\tmessage: compilerError.text,\n\t\t\tlocation: {\n\t\t\t\tline: compilerError.labels[0].line,\n\t\t\t\tcolumn: compilerError.labels[0].column,\n\t\t\t\tfile: filename,\n\t\t\t},\n\t\t\thint: compilerError.hint,\n\t\t});\n\t}\n\n\tswitch (cssTransformErrors.length) {\n\t\tcase 0:\n\t\t\tbreak;\n\t\tcase 1: {\n\t\t\tthrow cssTransformErrors[0];\n\t\t}\n\t\tdefault: {\n\t\t\tthrow new AggregateError({\n\t\t\t\t...cssTransformErrors[0],\n\t\t\t\terrors: cssTransformErrors,\n\t\t\t});\n\t\t}\n\t}\n}\n\nfunction normalizeFilename(filename: string, root: URL) {\n\tconst normalizedFilename = normalizePath(filename);\n\tconst normalizedRoot = normalizePath(fileURLToPath(root));\n\tif (normalizedFilename.startsWith(normalizedRoot)) {\n\t\treturn normalizedFilename.slice(normalizedRoot.length - 1);\n\t} else {\n\t\treturn normalizedFilename;\n\t}\n}\n","sourceCodeStart":101,"sourceCodeEnd":136,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/core/compile/compile.ts#L101-L136","documentation":"After the compiler runs, Astro processes `<style>` blocks and may produce CSS transform errors. If exactly one error exists it is re-thrown directly; if multiple exist they are wrapped in an `AggregateError` carrying all errors. This error has no static `code` — it surfaces the first CSS error's message. It represents a failure in transforming the CSS layer of an `.astro` component.","triggerScenarios":"An `.astro` component's `<style>` block contains CSS that fails the transform pipeline (e.g., invalid syntax caught by the CSS processor, or a preprocessing error). Multiple style errors in one component produce the `AggregateError` branch at `compile.ts:119`.","commonSituations":"Invalid CSS property values, unterminated declarations, unsupported `@import`, or a PostCSS/Lightning CSS transform rejecting the stylesheet; upgrading a CSS tool that newly rejects previously-tolerated input.","solutions":["Inspect the surfaced CSS error message and fix the offending `<style>` block.","If an `AggregateError`, iterate `.errors` to see every failing rule.","Validate the CSS in isolation (e.g., paste into a linter) to catch syntax issues faster.","Check for a recent CSS tooling upgrade that changed validation strictness."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isCssAggregate(e) { return e instanceof AggregateError && Array.isArray(e.errors); }","tryCatchPattern":"try {\n  await build();\n} catch (e) {\n  const errs = e instanceof AggregateError ? e.errors : [e];\n  for (const err of errs) { /* report CSS error */ }\n}","preventionTips":["Lint component <style> blocks with a CSS linter.","Validate CSS in isolation when an error message points to a style block.","Track CSS tooling upgrades that tighten validation."],"tags":["css","build","compiler","style"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}