{"record":{"id":"1dbbb96e1a5f5781","repo":"embassy-rs/embassy","slug":"no-stm32xx-cargo-feature-enabled","errorCode":null,"errorMessage":"No stm32xx Cargo feature enabled","messagePattern":"No stm32xx Cargo feature enabled","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32-wpan/build.rs","lineNumber":11,"sourceCode":"use std::path::PathBuf;\nuse std::{env, fs};\n\nfn main() {\n    match env::vars()\n        .map(|(a, _)| a)\n        .filter(|x| x.starts_with(\"CARGO_FEATURE_STM32\"))\n        .get_one()\n    {\n        Ok(_) => {}\n        Err(GetOneError::None) => panic!(\"No stm32xx Cargo feature enabled\"),\n        Err(GetOneError::Multiple) => panic!(\"Multiple stm32xx Cargo features enabled\"),\n    }\n\n    let out_dir = &PathBuf::from(env::var_os(\"OUT_DIR\").unwrap());\n\n    // ========\n    // stm32wb tl_mbox link sections\n\n    let out_file = out_dir.join(\"tl_mbox.x\").to_string_lossy().to_string();\n    let in_file;\n    if env::var_os(\"CARGO_FEATURE_EXTENDED\").is_some() {\n        if env::vars()\n            .map(|(a, _)| a)\n            .any(|x| x.starts_with(\"CARGO_FEATURE_STM32WB1\"))\n        {\n            in_file = \"tl_mbox_extended_wb1.x.in\";\n        } else {\n            in_file = \"tl_mbox_extended_wbx5.x.in\";","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32-wpan/build.rs#L1-L29","documentation":"embassy-stm32-wpan's build script requires exactly one `stm32xx` Cargo feature (the chip selection) to know which STM32 wireless MCU register definitions to generate. If no CARGO_FEATURE_STM32* variable is present at build time, no chip was selected, and the build script panics before compiling the crate.","triggerScenarios":"Building embassy-stm32-wpan as a dependency without enabling a chip feature like `stm32wb55xx` or `stm32wl55xx` in its [features] configuration; running `cargo check` in the crate with no default feature selected; forgetting the feature in a workspace member's dependency declaration.","commonSituations":"Adding embassy-stm32-wpan to Cargo.toml with default-features = false and no chip feature; copying a dependency line without features; tooling/builds that strip features; enabling two conflicting chip features would instead hit the companion 'Multiple' panic.","solutions":["Enable exactly one chip feature in Cargo.toml, e.g. `embassy-stm32-wpan = { version = \"...\", features = [\"stm32wb55xx\"] }`","If you intentionally disabled default features, add your target chip feature explicitly","Verify with `cargo tree -f '{f}'` or `cargo metadata` that the stm32 feature reaches embassy-stm32-wpan in your workspace (a feature unification issue may drop it)","Enable `embassy-stm32-wpam/unstable` only together with a chip feature as documented in the crate README"],"exampleFix":"// before (Cargo.toml)\nembassy-stm32-wpan = { version = \"0.1\", default-features = false }\n// after\nembassy-stm32-wpan = { version = \"0.1\", features = [\"stm32wb55xx\"] }","handlingStrategy":"validation","validationCode":"// verify feature selection before building (shell)\ncargo metadata --format-version 1 | \\\n  jq -e '.packages[] | select(.name==\"embassy-stm32-wpan\") | .features | keys | any(test(\"^stm32\"))'","typeGuard":null,"tryCatchPattern":"// build-script panic happens before your code runs; fix Cargo.toml features\n[dependencies]\nembassy-stm32-wpan = { version = \"0.1\", features = [\"stm32wb55xx\"] }","preventionTips":["Always name the chip feature explicitly when adding embassy-stm32-wpan","Never use default-features = false without adding a stm32xx feature","Check feature unification in workspaces with `cargo tree -f '{f}'`","Enable exactly one chip feature to avoid the companion 'Multiple' panic"],"tags":["build","cargo","stm32","feature-flags"],"backgroundTag":"missing-required-config","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}