PRQL/prql · error
Crate is not built with the `cli` feature enabled, or was…
Error message
Crate is not built with the `cli` feature enabled, or was built for a wasm target.
What it means
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.
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
Example fix
// before cargo build -p prqlc --no-default-features cargo run -p prqlc -- compile q.prql // after cargo build -p prqlc --features cli cargo run -p prqlc -- compile q.prql
Defensive patterns
Strategy: fallback
Validate before calling
# Check the feature is enabled before invoking cargo metadata --no-deps | jq -r '.packages[] | select(.name=="prqlc") | .features | keys[]' | grep -x cli
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- `lsp` requires `prqlc` to be built with the `lsp` feature
- prql_to_sql! proc macro expected a string
- {}
- Could not parse PRQL version
- Could not parse prqlc version number
AI-assisted analysis of PRQL/prql@e164e249b9 (2026-09-09).
Data as JSON: /api/errors/172b26d78686d021.
Report an issue: GitHub.
Appendix: source
Thrown at prqlc/prqlc/src/main.rs:21
#[cfg(all(not(target_family = "wasm"), feature = "cli"))]
fn main() -> color_eyre::eyre::Result<()> {
// Use a larger stack size (8 MiB) to avoid stack overflows on Windows,
// where the default stack is only 1 MiB.
const STACK_SIZE: usize = 8 * 1024 * 1024;
let thread = std::thread::Builder::new()
.stack_size(STACK_SIZE)
.spawn(cli::main)
.expect("failed to spawn main thread");
thread.join().expect("main thread panicked")?;
Ok(())
}
#[cfg(any(target_family = "wasm", not(feature = "cli")))]
fn main() {
panic!("Crate is not built with the `cli` feature enabled, or was built for a wasm target.");
}
View on GitHub (pinned to e164e249b9)