{"record":{"id":"3cd88320ef84213a","repo":"jdx/mise","slug":"mise-completion-metadata-should-parse","errorCode":null,"errorMessage":"mise completion metadata should parse","messagePattern":"mise completion metadata should parse","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/usage.rs","lineNumber":78,"sourceCode":"        // let a global shadow a same-named task flag, dropping its choices (mise#11282),\n        // and fail outright on `mise run --force <task>`. 3.5 was required for the zsh\n        // colon completion fixes for task names and insert strings (jdx/usage#666,\n        // jdx/usage#670).\n        // Declare what each command does to the world. clap cannot express this,\n        // so it is applied to the derived spec; see command_effects.\n        crate::cli::command_effects::apply(&mut spec);\n\n        spec.restamp();\n\n        spec\n    }\n}\n\npub(super) fn completion_spec() -> usage::Spec {\n    let mut spec = spec();\n    let extra: usage::Spec = include_str!(\"../assets/mise-extra.usage.kdl\")\n        .parse()\n        .expect(\"mise completion metadata should parse\");\n    spec.merge(extra);\n    spec\n}\n\nimpl Usage {\n    pub(crate) fn run(self) -> Result<()> {\n        // 3.6 added `effect=` (jdx/usage#739), 4.0 added it on flags and args\n        // (jdx/usage#742), and 6.6 added flags scoped to implicit clauses\n        // (jdx/usage#1343). 6.8 adds mount synopsis metadata (jdx/usage#1393).\n        // Older `usage` CLIs reject the spec outright, so this\n        // moves in lockstep with the fields and layouts the spec actually carries.\n        let min_version = r#\"min_usage_version \"6.8\"\"#;\n        println!(\"{min_version}\\n{}\", completion_spec().to_string().trim());\n        Ok(())\n    }\n}\n\n#[cfg(test)]","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/usage.rs#L60-L96","documentation":"`completion_spec()` parses the statically embedded `src/assets/mise-extra.usage.kdl` file at runtime via `include_str!`. Because the file ships with the binary, a parse failure means the checked-in asset is malformed — this `.expect()` turns that into a panic to surface the drift immediately.","triggerScenarios":"`mise-extra.usage.kdl` corrupted or hand-edited with invalid KDL syntax; a KDL schema change in the usage parser no longer accepted by the older asset (or vice versa after a dependency bump); build tooling mangling the asset.","commonSituations":"Contributors editing completion metadata directly with a syntax mistake; merge conflicts in the asset resolved incorrectly; users only hit this on broken dev builds or corrupted installs.","solutions":["Validate the KDL with a parser: change the file, then run `mise run build && target/debug/mise usage` to reproduce and fix the syntax error","Restore the pristine asset from git: `git checkout HEAD -- src/assets/mise-extra.usage.kdl`","If it appeared after a dependency update, align the asset syntax with the new parser requirements","Reinstall mise from an official release if your local copy is corrupted"],"exampleFix":"// before (mise-extra.usage.kdl)\nroot flag \"--raw\" \"-r\" help=\"Raw output\" arg(\"value\") optional\n// after (valid KDL node form)\nflag \"--raw\" \"-r\" help=\"Raw output\" {\n    arg value\n    optional\n}","handlingStrategy":"validation","validationCode":"# Validate the asset parses after editing it:\ncargo build && target/debug/mise usage > /dev/null && echo OK","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `mise run build` (or `mise run test`) whenever touching src/assets/*.kdl","Resolve merge conflicts in usage assets by regenerating, not hand-merging","Keep the asset syntax aligned with the usage crate version in Cargo.lock"],"tags":["rust","panic","internal-invariant","completions","kdl"],"backgroundTag":"schema-validation-failed","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}