{"id":"75eb339cc063986a","repo":"vitejs/vite","slug":"unknown-lang-lang","errorCode":null,"errorMessage":"Unknown lang: ${lang}","messagePattern":"Unknown lang: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vite/src/node/plugins/css.ts","lineNumber":3378,"sourceCode":"              const lang = CSS_LANGS_RE.exec(from)?.[1] as CssLang | undefined\n              let resolver: ResolveIdFn\n              switch (lang) {\n                case 'css':\n                case 'sss':\n                case 'styl':\n                case 'stylus':\n                case undefined:\n                  resolver = atImportResolvers.css\n                  break\n                case 'sass':\n                case 'scss':\n                  resolver = atImportResolvers.sass\n                  break\n                case 'less':\n                  resolver = atImportResolvers.less\n                  break\n                default:\n                  throw new Error(`Unknown lang: ${lang satisfies never}`)\n              }\n\n              const resolved = await resolver(environment, id, from)\n              if (resolved) {\n                deps.add(resolved)\n                return resolved\n              }\n              return id\n            },\n          },\n          minify: config.isProduction && !!config.build.cssMinify,\n          sourceMap:\n            config.command === 'build'\n              ? !!config.build.sourcemap\n              : config.css.devSourcemap,\n          analyzeDependencies: { preserveImports: true },\n          cssModules: cssModuleRE.test(id)\n            ? (config.css.lightningcss?.cssModules ?? true)","sourceCodeStart":3360,"sourceCodeEnd":3396,"githubUrl":"https://github.com/vitejs/vite/blob/89620f09afcfef6b35e7bb8660132ab5b4d0cd3b/packages/vite/src/node/plugins/css.ts#L3360-L3396","documentation":"An exhaustiveness guard inside the lightningcss-based CSS dependency resolver. When resolving `@import`/`@use`, the code switches on `lang` (css/styl/sass/scss/less) and the `default` branch throws. The `satisfies never` annotation makes this a compile-time check too; a runtime hit means a lang value slipped through that the switch does not cover.","triggerScenarios":"Calling the lightningcss `@import` resolver path with a `lang` value outside `{ undefined, 'styl', 'stylus', 'sass', 'scss', 'less' }`. This is gated by `CSS_LANGS_RE`, so it normally only happens with a bug in lang detection.","commonSituations":"Internal Vite bug after adding a new CSS dialect, a custom plugin that mutates the id extension/lang before this resolver runs, or a malformed lang string in a request.","solutions":["Report the `lang` value from the message — it indicates a Vite-internal or plugin-introduced inconsistency.","Remove custom plugins that alter CSS file extensions/langs to isolate the cause.","Update Vite to the latest version; lang-handling bugs are patched regularly."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await transformCss();\n} catch (e) {\n  if (/Unknown lang:/.test(e.message)) {\n    console.error('Unexpected CSS lang — disable custom CSS lang plugins and update Vite');\n  }\n  throw e;\n}","preventionTips":["Avoid custom plugins that mutate CSS file extensions/langs before Vite's resolver runs.","Keep Vite updated so new CSS dialects are handled."],"tags":["css","lightningcss","internal","preprocessor"],"analyzedSha":"89620f09afcfef6b35e7bb8660132ab5b4d0cd3b","analyzedAt":"2026-08-03T19:28:02.920Z","schemaVersion":2}