{"record":{"id":"b4684a9104f3152c","repo":"jdx/mise","slug":"brew-cask-command-wrapper-args-and-env-require-ex-b4684a","errorCode":null,"errorMessage":"brew-cask: command_wrapper args and env require executable","messagePattern":"brew-cask: command_wrapper args and env require executable","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask/artifacts.rs","lineNumber":249,"sourceCode":"                .ok_or_else(|| eyre!(\"brew-cask: command_wrapper env must be an object\"))?\n                .iter()\n                .map(|(key, value)| {\n                    if !is_shell_env_name(key) {\n                        bail!(\"brew-cask: invalid command_wrapper environment name '{key}'\");\n                    }\n                    value\n                        .as_str()\n                        .map(|value| (key.clone(), value.to_string()))\n                        .ok_or_else(|| {\n                            eyre!(\"brew-cask: command_wrapper environment values must be strings\")\n                        })\n                })\n                .collect::<Result<BTreeMap<_, _>>>()\n        })\n        .transpose()?\n        .unwrap_or_default();\n    if content.is_some() && (!args.is_empty() || !env.is_empty()) {\n        bail!(\"brew-cask: command_wrapper args and env require executable\");\n    }\n    Ok(Some(CommandWrapperArtifact {\n        name: name.to_string(),\n        target: artifact_target(value, values),\n        content,\n        executable,\n        args,\n        env,\n    }))\n}\n\npub(super) fn parse_pkg_artifact(value: &Value) -> Result<Option<PkgArtifact>> {\n    let Some(pkg) = value.as_object().and_then(|o| o.get(\"pkg\")) else {\n        return Ok(None);\n    };\n    match pkg {\n        Value::String(source) => Ok(Some(PkgArtifact {\n            source: source.clone(),","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/cask/artifacts.rs#L231-L267","documentation":"Thrown when a command_wrapper specifies `content` but also non-empty `args` or `env`. Args and environment only make sense when invoking an external executable; inline content has nothing to attach them to.","triggerScenarios":"Options object with 'content' set and at least one entry in 'args' or 'env'.","commonSituations":"Switching from executable-based to content-based wrapper without removing args/env; misunderstanding that args/env only apply to executable wrappers.","solutions":["Move args/env into the content script itself and remove them from options.","Or switch from `content` to an `executable` wrapper so args/env apply."],"exampleFix":"// before\n[\"mytool\", {\"content\": \"#!/bin/sh\\necho hi\", \"args\": [\"-v\"]}]\n// after\n[\"mytool\", {\"executable\": \"mytool\", \"args\": [\"-v\"]}]","handlingStrategy":"validation","validationCode":"fn cw_content_standalone(o: &serde_json::Value) -> bool {\n    if o.get(\"content\").is_some() {\n        let no_args = o.get(\"args\").and_then(|a| a.as_array()).map_or(true, |a| a.is_empty());\n        let no_env = o.get(\"env\").and_then(|e| e.as_object()).map_or(true, |m| m.is_empty());\n        no_args && no_env\n    } else { true }\n}\nassert!(cw_content_standalone(&opts));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Inline any needed arguments directly into content scripts","Only attach args/env to executable wrappers","Review content-based wrappers for stray args/env options"],"tags":["brew-cask","validation","conflicting-options","config"],"backgroundTag":"conflicting-config-options","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"}