{"record":{"id":"20735e1ba502e60d","repo":"biomejs/biome","slug":"unknown-distribution-distribution","errorCode":null,"errorMessage":"Unknown distribution: ${distribution}","messagePattern":"Unknown distribution: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@biomejs/js-api/src/index.ts","lineNumber":61,"sourceCode":"\nexport interface BiomeCreate {\n\tdistribution: Distribution;\n}\n\nexport class Biome extends BiomeCommon<Configuration, Diagnostic> {\n\t/**\n\t * It creates a new instance of the class {Biome}.\n\t */\n\tstatic async create({ distribution }: BiomeCreate): Promise<Biome> {\n\t\tswitch (distribution) {\n\t\t\tcase Distribution.BUNDLER:\n\t\t\t\treturn new Biome(await import(\"@biomejs/wasm-bundler\"));\n\t\t\tcase Distribution.NODE:\n\t\t\t\treturn new Biome(await import(\"@biomejs/wasm-nodejs\"));\n\t\t\tcase Distribution.WEB:\n\t\t\t\treturn new Biome(await import(\"@biomejs/wasm-web\"));\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Unknown distribution: ${distribution}`);\n\t\t}\n\t}\n}\n","sourceCodeStart":43,"sourceCodeEnd":65,"githubUrl":"https://github.com/biomejs/biome/blob/7529811358079edb5a2a9d4a5f67a9f639a63f3a/packages/@biomejs/js-api/src/index.ts#L43-L65","documentation":"Biome.create() maps the Distribution enum to one of three WASM packages: BUNDLER (0) -> @biomejs/wasm-bundler, NODE (1) -> @biomejs/wasm-nodejs, WEB (2) -> @biomejs/wasm-web (js-api/src/index.ts:52-62). Any other value falls through the switch to the default arm and throws, because there is no WASM module to import for it.","triggerScenarios":"Calling Biome.create({ distribution: \"node\" }) with a string instead of the enum member; passing undefined because the property is missing or misnamed in the object literal; passing a number from config that does not equal 0, 1, or 2; stale serialized enum values after an upgrade renumbers the enum.","commonSituations":"Copying example code that uses strings; reading the distribution from CLI args, environment, or JSON config without validation; upgrading @biomejs/js-api across releases where the enum changed shape; forgetting that the enum must be imported from @biomejs/js-api itself.","solutions":["Import Distribution from @biomejs/js-api and pass the enum member: Distribution.NODE for Node.js, Distribution.WEB for browsers, Distribution.BUNDLER for bundlers.","If the value comes from config or env, validate it against Object.values(Distribution) before calling Biome.create.","Ensure the matching @biomejs/wasm-* package for the chosen distribution is installed in the project."],"exampleFix":"// before\nconst biome = await Biome.create({ distribution: \"node\" });\n\n// after\nimport { Biome, Distribution } from \"@biomejs/js-api\";\nconst biome = await Biome.create({ distribution: Distribution.NODE });","handlingStrategy":"type-guard","validationCode":"import { Biome, Distribution } from \"@biomejs/js-api\";\n\nif (!Object.values(Distribution).includes(distribution)) {\n\tthrow new Error(`Invalid distribution ${String(distribution)}; use Distribution.NODE, Distribution.WEB, or Distribution.BUNDLER`);\n}\nconst biome = await Biome.create({ distribution });","typeGuard":"import { Distribution } from \"@biomejs/js-api\";\n\nfunction isValidDistribution(value: unknown): value is Distribution {\n\treturn typeof value === \"number\" && value in Distribution;\n}\n\n// usage\nif (!isValidDistribution(config.distribution)) {\n\tthrow new Error(\"distribution must be one of the Distribution enum members\");\n}\nconst biome = await Biome.create({ distribution: config.distribution });","tryCatchPattern":"try {\n\tconst biome = await Biome.create({ distribution });\n} catch (err) {\n\tif (err instanceof Error && err.message.startsWith(\"Unknown distribution:\")) {\n\t\t// re-raise with user-facing guidance\n\t\tthrow new Error(`Unsupported distribution ${String(distribution)}. Pass Distribution.NODE, Distribution.WEB, or Distribution.BUNDLER.`);\n\t}\n\tthrow err;\n}","preventionTips":["Always import and use the Distribution enum members; never hand-write numbers or strings.","When the value comes from config/env/CLI, validate it against Object.values(Distribution) before calling create.","Install the @biomejs/wasm-* package that matches the chosen distribution."],"tags":["typescript","wasm","api","enum","configuration"],"backgroundTag":"invalid-enum-argument","analyzedSha":"7529811358079edb5a2a9d4a5f67a9f639a63f3a","analyzedAt":"2026-08-16T22:13:27.842Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}