{"record":{"id":"446486e8849b7504","repo":"pola-rs/polars","slug":"missing-command-generate-update-hashes-check-ha","errorCode":null,"errorMessage":"missing command [generate, update-hashes, check-hashes]","messagePattern":"missing command \\[generate, update-hashes, check-hashes\\]","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-plan/src/bin/dsl-schema.rs","lineNumber":48,"sourceCode":"#[cfg(feature = \"dsl-schema\")]\nmod impls {\n    use std::fs::File;\n    use std::io::Write;\n    use std::path::Path;\n\n    use polars_plan::dsl::DslPlan;\n    use schemars::Schema;\n    use sha2::Digest;\n\n    const DEFAULT_HASHES_PATH: &str = \"crates/polars-plan/dsl-schema-hashes.json\";\n\n    pub fn run() {\n        let mut args = std::env::args();\n\n        let _ = args.next();\n        let cmd = args\n            .next()\n            .expect(\"missing command [generate, update-hashes, check-hashes]\");\n        let path = args.next();\n\n        if let Some(unknown) = args.next() {\n            panic!(\"unknown argument: `{unknown}`\");\n        }\n\n        match cmd.as_str() {\n            \"generate\" => {\n                generate(path.unwrap_or(\"./dsl-schema.json\".to_owned()));\n            },\n            \"update-hashes\" => {\n                update_hashes(path.unwrap_or(DEFAULT_HASHES_PATH.to_owned()));\n            },\n            \"check-hashes\" => {\n                check_hashes(path.unwrap_or(DEFAULT_HASHES_PATH.to_owned()));\n            },\n            unknown => {\n                panic!(\"unknown command: `{unknown}`\");","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-plan/src/bin/dsl-schema.rs#L30-L66","documentation":"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.","triggerScenarios":"Running the binary (e.g. `dsl-schema` or via cargo/make target) with zero arguments: `args.next()` after the program name returns None.","commonSituations":"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.","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."],"exampleFix":"// before\ncargo run -p polars-plan --bin dsl-schema\n\n// after\ncargo run -p polars-plan --bin dsl-schema -- generate","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\nif [ $# -lt 1 ]; then echo \"usage: dsl-schema [generate|update-hashes|check-hashes] [path]\" >&2; exit 1; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["cli","panic","missing-argument"],"backgroundTag":"missing-cli-argument","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}