{"record":{"id":"a47e3582cebeef25","repo":"biomejs/biome","slug":"formatting-embedded-javascript-snippets-requires-t","errorCode":null,"errorMessage":"formatting embedded JavaScript snippets requires the `js_embeds` feature","messagePattern":"formatting embedded JavaScript snippets requires the `js_embeds` feature","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/biome_service/src/file_handlers/javascript.rs","lineNumber":1800,"sourceCode":"        formatted.propagate_expand();\n\n        match formatted.print() {\n            Ok(printed) => Ok(printed),\n            Err(error) => Err(WorkspaceError::FormatError(error.into())),\n        }\n    }\n\n    #[cfg(not(feature = \"js_embeds\"))]\n    {\n        let _ = (\n            biome_path,\n            document_file_source,\n            parse,\n            settings,\n            embedded_nodes,\n            workspace_db,\n        );\n        panic!(\"formatting embedded JavaScript snippets requires the `js_embeds` feature\")\n    }\n}\n\npub(crate) fn pull_diagnostics_and_actions(\n    params: DiagnosticsAndActionsParams,\n) -> PullDiagnosticsAndActionsResult {\n    let DiagnosticsAndActionsParams {\n        parsed_source,\n        settings,\n        language,\n        path,\n        only,\n        skip,\n        categories,\n        workspace_db,\n        project_layout,\n        suppression_reason,\n        enabled_selectors,","sourceCodeStart":1782,"sourceCodeEnd":1818,"githubUrl":"https://github.com/biomejs/biome/blob/0fca643d22845c28e0e0b7375013155e3f80717f/crates/biome_service/src/file_handlers/javascript.rs#L1782-L1818","documentation":"Panic in the embedded-formatting closure of the JavaScript handler (javascript.rs:1755-1766). When biome_service is compiled without the js_embeds cargo feature, formatting a document that contains embedded snippets (e.g. CSS or GraphQL inside JS template literals) reaches this #[cfg(not(feature = \"js_embeds\"))] block, which discards its arguments and panics. The feature flag exists because embedded formatting pulls in extra formatter dependencies; official Biome binaries ship with it enabled.","triggerScenarios":"A downstream crate builds biome_service with the js_embeds feature off (e.g. default-features = false) and then formats a JS-family document whose parse contains embedded nodes, invoking format_embedded (javascript.rs:1691) with a non-empty snippet set.","commonSituations":"Custom tooling that embeds biome_service and trims features for compile time/binary size; feature unification accidentally disabling defaults (another dependency pulling biome_service with default-features = false); building only parts of the workspace (cargo build -p) without the workspace's full feature set.","solutions":["Enable the feature: depend on biome_service with features = [\"js_embeds\"] (or default features) and rebuild","If embedded formatting is not needed, disable it at the configuration level so format_embedded is never called with snippets (avoid formatting files containing embedded CSS/GraphQL)","Check cargo tree -e features biome_service to confirm who is disabling the feature before blaming your own manifest"],"exampleFix":"# before\nbiome_service = { path = \"../biome_service\", default-features = false }\n\n# after\nbiome_service = { path = \"../biome_service\", default-features = false, features = [\"js_embeds\"] }","handlingStrategy":"validation","validationCode":"# Cargo.toml - declare the feature explicitly\nbiome_service = { path = \"../biome_service\", features = [\"js_embeds\"] }\n\n# tests/smoke.rs - fail fast if the feature is off in your build\n#[test]\nfn js_embeds_feature_is_enabled() {\n    let formatted = format_js_with_embed(\"const s = css`color: red;`\");\n    assert!(formatted.is_ok(), \"biome_service was built without js_embeds\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never build biome_service with default-features = false without re-enabling js_embeds when you format JS-family files","Audit feature unification with cargo tree -e features biome_service after dependency changes","Add a smoke test that formats a CSS-in-JS snippet to catch feature regressions in CI"],"tags":["rust","cargo-features","formatting","embedded-code","panic"],"backgroundTag":"missing-cargo-feature","analyzedSha":"0fca643d22845c28e0e0b7375013155e3f80717f","analyzedAt":"2026-08-20T00:25:09.682Z","contentChangedAt":"2026-08-20T00:25:09.682Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}