{"record":{"id":"18e942804eb0edbf","repo":"jdx/mise","slug":"brew-cask-generate-completions-from-executable-re-18e942","errorCode":null,"errorMessage":"brew-cask: generate_completions_from_executable requires at least one shell","messagePattern":"brew-cask: generate_completions_from_executable requires at least one shell","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask/artifacts.rs","lineNumber":467,"sourceCode":"    let shells = options\n        .and_then(|o| o.get(\"shells\"))\n        .and_then(Value::as_array)\n        .map(|shells| {\n            shells\n                .iter()\n                .map(|shell| {\n                    let shell = shell.as_str().ok_or_else(|| {\n                        eyre!(\"brew-cask: completion shell names must be strings\")\n                    })?;\n                    CompletionShell::parse(shell)\n                        .ok_or_else(|| eyre!(\"brew-cask: unsupported completion shell '{shell}'\"))\n                })\n                .collect::<Result<Vec<_>>>()\n        })\n        .transpose()?\n        .unwrap_or_else(|| default_generated_completion_shells(shell_parameter_format.as_deref()));\n    if shells.is_empty() {\n        bail!(\"brew-cask: generate_completions_from_executable requires at least one shell\");\n    }\n    Ok(Some(GeneratedCompletionArtifact {\n        executable,\n        args,\n        base_name: options\n            .and_then(|o| o.get(\"base_name\"))\n            .and_then(Value::as_str)\n            .map(str::to_string),\n        shell_parameter_format,\n        shells,\n    }))\n}\n\npub(super) fn default_generated_completion_shells(format: Option<&str>) -> Vec<CompletionShell> {\n    match format {\n        Some(\"cobra\") | Some(\"typer\") => vec![\n            CompletionShell::Bash,\n            CompletionShell::Zsh,","sourceCodeStart":449,"sourceCodeEnd":485,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/cask/artifacts.rs#L449-L485","documentation":"A `generate_completions_from_executable` artifact may restrict which shells completions are generated for via its `shells` option. After resolving explicit shells (or falling back to defaults), if the resulting shell list is empty, parsing bails because completions for zero shells are meaningless.","triggerScenarios":"Setting `shells = []` in the artifact options, producing an empty list after `unwrap_or_else(default_generated_completion_shells)` in `parse_generated_completion_artifact`.","commonSituations":"Explicitly disabling shells by passing an empty array instead of removing the artifact; or editing a shared cask template where the shells list was emptied.","solutions":["List at least one shell in the `shells` option, e.g. `shells = [\"bash\", \"zsh\"]`.","Remove the `shells` option to use the default shell set, or remove the artifact stanza if no completions are wanted."],"exampleFix":"// before\n[artifacts.generate_completions_from_executable.options]\nshells = []\n// after\n[artifacts.generate_completions_from_executable.options]\nshells = [\"bash\", \"zsh\"]","handlingStrategy":"validation","validationCode":"const opts = cask.generate_completions_from_executable?.options ?? {};\nif (Array.isArray(opts.shells) && opts.shells.length === 0)\n  throw new Error(\"shells must list at least one shell\");","typeGuard":"function hasShells(opts) {\n  return !opts?.shells || (Array.isArray(opts.shells) && opts.shells.length > 0);\n}","tryCatchPattern":"try {\n  parseCaskArtifacts(cask);\n} catch (err) {\n  if (err.message.includes(\"requires at least one shell\")) {\n    // remove the empty shells option or add shells\n  } else throw err;\n}","preventionTips":["Omit the `shells` option entirely to use defaults instead of passing an empty array.","Only use known shell names (bash, zsh, fish) in the shells list."],"tags":["brew-cask","config","completions","empty-value"],"backgroundTag":"empty-required-field","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}