pola-rs/polars · error
missing command [generate, update-hashes, check-hashes]
Error message
missing command [generate, update-hashes, check-hashes]
What it means
The dsl-schema helper binary panics when it is invoked with no subcommand. `std::env::args().next()` skips the program name, and `.expect(...)` on the second argument raises this panic because the binary requires one of generate, update-hashes, or check-hashes. It is a fail-fast guard for CLI misuse, not a runtime library failure.
Solutions
- Pass one of the required subcommands: `generate`, `update-hashes`, or `check-hashes`.
- If using `cargo run --bin dsl-schema`, put the subcommand after `--` (e.g. `cargo run --bin dsl-schema -- generate`).
- Use the project's make targets (e.g. `make update-dsl-schema-hashes`) instead of invoking the binary manually.
Example fix
// before cargo run -p polars-plan --bin dsl-schema // after cargo run -p polars-plan --bin dsl-schema -- generate
Defensive patterns
Strategy: validation
Validate before calling
#!/usr/bin/env bash if [ $# -lt 1 ]; then echo "usage: dsl-schema [generate|update-hashes|check-hashes] [path]" >&2; exit 1; fi
Prevention
- Always invoke the binary through the project's make targets.
- Wrap direct cargo invocations with `--` followed by the subcommand.
- Add a shell wrapper that validates argument count before exec.
When it happens
Trigger: Running the binary (e.g. `dsl-schema` or via cargo/make target) with zero arguments: `args.next()` after the program name returns None.
Common situations: Invoking the binary directly without knowing it needs a subcommand, a Makefile/CI script whose arguments were dropped, or accidentally running the bin target with `cargo run -p polars-plan --bin dsl-schema` and forgetting the command.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
- unknown argument
- unknown command
- activate 'decompress' feature
- activate dtype
- activate feature dynamic_group_by
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/446486e8849b7504.
Report an issue: GitHub.
Appendix: source
Thrown at crates/polars-plan/src/bin/dsl-schema.rs:48
#[cfg(feature = "dsl-schema")]
mod impls {
use std::fs::File;
use std::io::Write;
use std::path::Path;
use polars_plan::dsl::DslPlan;
use schemars::Schema;
use sha2::Digest;
const DEFAULT_HASHES_PATH: &str = "crates/polars-plan/dsl-schema-hashes.json";
pub fn run() {
let mut args = std::env::args();
let _ = args.next();
let cmd = args
.next()
.expect("missing command [generate, update-hashes, check-hashes]");
let path = args.next();
if let Some(unknown) = args.next() {
panic!("unknown argument: `{unknown}`");
}
match cmd.as_str() {
"generate" => {
generate(path.unwrap_or("./dsl-schema.json".to_owned()));
},
"update-hashes" => {
update_hashes(path.unwrap_or(DEFAULT_HASHES_PATH.to_owned()));
},
"check-hashes" => {
check_hashes(path.unwrap_or(DEFAULT_HASHES_PATH.to_owned()));
},
unknown => {
panic!("unknown command: `{unknown}`");View on GitHub (pinned to fe841f959e)