{"record":{"id":"c09fe0575384b974","repo":"oven-sh/bun","slug":"build-prefixes-js-could-not-find-the-features-bit","errorCode":null,"errorMessage":"build-prefixes.js: could not find the Features bitflags! block in src/css/targets.rs","messagePattern":"build-prefixes\\.js: could not find the Features bitflags! block in src/css/targets\\.rs","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/css/build-prefixes.js","lineNumber":535,"sourceCode":"    `    /// Autogenerated by build-prefixes.js`,\n    `    /// Features to explicitly enable or disable.`,\n    `    #[derive(Debug, Clone, Copy, PartialEq, Eq)]`,\n    `    pub struct Features: u32 {`,\n    ...scalar.map((f, i) => `        const ${f.toUpperCase().padEnd(pad)} = 1 << ${i};`),\n    ``,\n    ...groups.flatMap(([name, members], i) => {\n      const body = members.map(m => `Self::${m.toUpperCase()}.bits()`).join(\"\\n            | \");\n      const line = `        const ${name.toUpperCase()} = ${body};`;\n      return i > 0 ? [``, line] : [line];\n    }),\n    `    }`,\n    `}`,\n  ].join(\"\\n\");\n\n  let targets = fs.readFileSync(\"src/css/targets.rs\", \"utf8\");\n  const re = /bitflags::bitflags! \\{\\n    \\/\\/\\/ Autogenerated by build-prefixes\\.js(?:.|\\n)+?\\n    \\}\\n\\}/;\n  if (!re.test(targets)) {\n    throw new Error(\"build-prefixes.js: could not find the Features bitflags! block in src/css/targets.rs\");\n  }\n  targets = targets.replace(re, lines);\n  fs.writeFileSync(\"src/css/targets.rs\", targets);\n  await rustfmt(\"src/css/targets.rs\");\n  console.log(\"wrote src/css/targets.rs (Features block)\");\n}\n\n// ─── prefixes.rs ──────────────────────────────────────────────────────────\n{\n  const variants = [...new Set([...p.keys()].flat().map(enumify))].sort();\n  const arms = [];\n  for (const [features, versions] of p) {\n    const pats = features.map(enumify).join(\"\\n            | \");\n    const body = [];\n    for (const [name, pfx] of Object.entries(versions)) {\n      const inner = [];\n      for (const [prefix, [min, max]] of Object.entries(pfx)) {\n        if (!prefixConst[prefix]) throw new Error(\"Missing prefix \" + prefix);","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/css/build-prefixes.js#L517-L553","documentation":"build-prefixes.js regenerates the CSS `Features` bitflags block inside src/css/targets.rs. It locates the block by the marker comment `/// Autogenerated by build-prefixes.js` inside a `bitflags::bitflags! {` wrapper; if the regex no longer matches, it refuses to write rather than corrupting the file.","triggerScenarios":"Hand-editing or reformatting the autogenerated Features block in src/css/targets.rs so the marker comment or the `\\n    }\\n}` block structure changed, moved, or was deleted.","commonSituations":"Running rustfmt with different settings over targets.rs, resolving a merge conflict in the block by rewriting it, or manually adding a feature flag inside the autogenerated region.","solutions":["Restore the block structure: start with `bitflags::bitflags! {` followed by `    /// Autogenerated by build-prefixes.js` and close with the matched braces so the regex /bitflags::bitflags! \\{\\n    \\/\\/\\/ Autogenerated by build-prefixes\\.js[\\s\\S]+?\\n    \\}\\n\\}/ matches.","Never edit inside the autogenerated Features region — add new flags to the generator (build-prefixes.js) instead.","If targets.rs is too far gone, `git checkout src/css/targets.rs` and rerun the generator."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const re = /bitflags::bitflags! \\{\\n    \\/\\/\\/ Autogenerated by build-prefixes\\.js(?:.|\\n)+?\\n    \\}\\n\\}/;\nconst targets = fs.readFileSync(\"src/css/targets.rs\", \"utf8\");\nif (!re.test(targets)) throw new Error(\"targets.rs: autogenerated Features block marker missing/modified\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-edit the autogenerated Features block in src/css/targets.rs — change build-prefixes.js instead.","Keep the marker comment `/// Autogenerated by build-prefixes.js` on its own line right after the bitflags! brace.","Exclude targets.rs's generated region from editor auto-format-on-save."],"tags":["codegen","css","bitflags","autogenerated"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}