{"record":{"id":"9335ee55398d775f","repo":"jdx/mise","slug":"brew-cask-unsupported-kind-sudo-setting-9335ee","errorCode":null,"errorMessage":"brew-cask:{}: unsupported {kind} sudo setting","messagePattern":"brew-cask:(.+?): unsupported (.+?) sudo setting","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask/artifacts.rs","lineNumber":848,"sourceCode":"        }\n        _ => bail!(\n            \"brew-cask:{}: unsupported {kind} step type {}\",\n            cask.token,\n            step_type\n        ),\n    }\n}\n\npub(super) fn parse_flight_sudo(\n    cask: &Cask,\n    kind: &str,\n    value: Option<&Value>,\n) -> Result<FlightSudo> {\n    match value {\n        None | Some(Value::Bool(false)) => Ok(FlightSudo::Never),\n        Some(Value::Bool(true)) => Ok(FlightSudo::Always),\n        Some(Value::String(value)) if value == \"if_needed\" => Ok(FlightSudo::IfNeeded),\n        _ => bail!(\"brew-cask:{}: unsupported {kind} sudo setting\", cask.token),\n    }\n}\n\npub(super) fn parse_flight_guards(\n    cask: &Cask,\n    kind: &str,\n    value: Option<&Value>,\n) -> Result<Vec<FlightGuard>> {\n    value\n        .map(|guards| {\n            guards\n                .as_array()\n                .ok_or_else(|| {\n                    eyre!(\n                        \"brew-cask:{}: unsupported {kind} guards metadata format\",\n                        cask.token\n                    )\n                })?","sourceCodeStart":830,"sourceCodeEnd":866,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/cask/artifacts.rs#L830-L866","documentation":"A flight step's `sudo` setting controls when a step runs with elevation: only three values are accepted — boolean `false`/absent (never), boolean `true` (always), and the string `\"if_needed\"`. Any other value triggers this bail in parse_flight_sudo.","triggerScenarios":"A cask sets `sudo = \"always\"`, `sudo = \"auto\"`, `sudo = 1`, or any non-accepted value on a Symlink (or other) flight step; FlightStep::Symlink parsing calls parse_flight_sudo which hits the catch-all arm.","commonSituations":"Porting Homebrew cask `sudo` DSL semantics with richer values; assuming string synonyms like \"never\" work; numeric booleans from generated config.","solutions":["Replace the value with `true` (always sudo), `false` (never), or the string `\"if_needed\"`.","Remove the `sudo` key to use the default (never).","When migrating from Homebrew, map :always -> true and omit other forms."],"exampleFix":"// before\n[[install.flight_steps]]\ntype = \"symlink\"\nsource = \"bin/myapp\"\ntarget = \"/usr/local/bin/myapp\"\nsudo = \"always\"\n// after\n[[install.flight_steps]]\ntype = \"symlink\"\nsource = \"bin/myapp\"\ntarget = \"/usr/local/bin/myapp\"\nsudo = true","handlingStrategy":"type-guard","validationCode":"function validateSudo(step) {\n  const ok = step.sudo === undefined || step.sudo === true || step.sudo === false || step.sudo === 'if_needed';\n  if (!ok) throw new Error(`unsupported sudo setting: ${JSON.stringify(step.sudo)}`);\n}","typeGuard":"const isValidSudo = (s) => s === undefined || typeof s === 'boolean' || s === 'if_needed';","tryCatchPattern":null,"preventionTips":["Use only true / false / \"if_needed\" — no string synonyms like \"always\".","Map Homebrew :always to `true` when migrating.","Leave `sudo` off entirely when the default (never) is desired."],"tags":["brew-cask","config-validation","sudo","enum-value"],"backgroundTag":"invalid-enum-value","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"}