{"record":{"id":"172b26d78686d021","repo":"PRQL/prql","slug":"crate-is-not-built-with-the-cli-feature-enabled","errorCode":null,"errorMessage":"Crate is not built with the `cli` feature enabled, or was built for a wasm target.","messagePattern":"Crate is not built with the `cli` feature enabled, or was built for a wasm target\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"prqlc/prqlc/src/main.rs","lineNumber":21,"sourceCode":"\n#[cfg(all(not(target_family = \"wasm\"), feature = \"cli\"))]\nfn main() -> color_eyre::eyre::Result<()> {\n    // Use a larger stack size (8 MiB) to avoid stack overflows on Windows,\n    // where the default stack is only 1 MiB.\n    const STACK_SIZE: usize = 8 * 1024 * 1024;\n\n    let thread = std::thread::Builder::new()\n        .stack_size(STACK_SIZE)\n        .spawn(cli::main)\n        .expect(\"failed to spawn main thread\");\n\n    thread.join().expect(\"main thread panicked\")?;\n    Ok(())\n}\n\n#[cfg(any(target_family = \"wasm\", not(feature = \"cli\")))]\nfn main() {\n    panic!(\"Crate is not built with the `cli` feature enabled, or was built for a wasm target.\");\n}\n","sourceCodeStart":3,"sourceCodeEnd":23,"githubUrl":"https://github.com/PRQL/prql/blob/e164e249b99485890036eb60f57c37520379b240/prqlc/prqlc/src/main.rs#L3-L23","documentation":"The prqlc binary's main() has two variants: one gated behind the `cli` feature for non-wasm targets, and a stub that panics when the crate is compiled without that feature or for a wasm target. Hitting it means the binary was built in a configuration in which no CLI is available.","triggerScenarios":"Running `cargo run -p prqlc` (or executing the built binary) when built with --no-default-features, a feature set that excludes `cli`, or when targeting wasm32 via cargo run.","commonSituations":"Using prqlc as a library dependency and accidentally executing its bin target; building with --no-default-features for a minimal wasm build then trying to invoke the CLI; CI jobs that strip default features.","solutions":["Build with default features or explicitly: cargo install prqlc --features cli (or cargo build -p prqlc --features cli)","Remove --no-default-features from the build command","If targeting wasm, use the wasm/npm binding instead of the CLI binary","Check the feature flags in your Cargo workspace/CI config so the cli feature stays enabled for the bin target"],"exampleFix":"// before\ncargo build -p prqlc --no-default-features\ncargo run -p prqlc -- compile q.prql\n// after\ncargo build -p prqlc --features cli\ncargo run -p prqlc -- compile q.prql","handlingStrategy":"fallback","validationCode":"# Check the feature is enabled before invoking\ncargo metadata --no-deps | jq -r '.packages[] | select(.name==\"prqlc\") | .features | keys[]' | grep -x cli","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install the CLI with default features (cargo install prqlc)","Never build the bin target with --no-default-features for local use","For wasm targets, use the prql wasm/npm package instead of the binary"],"tags":["rust","cli","feature-flags"],"backgroundTag":"feature-not-enabled","analyzedSha":"e164e249b99485890036eb60f57c37520379b240","analyzedAt":"2026-09-09T12:18:38.727Z","contentChangedAt":"2026-09-09T12:18:38.727Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}