{"record":{"id":"8ab20c0b6f55e0c6","repo":"jdx/mise","slug":"agent-name-must-set-a-non-empty-program","errorCode":null,"errorMessage":"agent '{name}' must set a non-empty `program`","messagePattern":"agent '(.+?)' must set a non-empty `program`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/launchd.rs","lineNumber":110,"sourceCode":"\n#[derive(Debug, Clone, PartialEq, Eq)]\npub struct LaunchdStatus {\n    pub request: LaunchdRequest,\n    pub path: PathBuf,\n    pub loaded: bool,\n    pub state: LaunchdState,\n}\n\nimpl LaunchdRequest {\n    pub fn from_toml(name: String, config: LaunchdTomlConfig) -> Result<Self> {\n        if !valid_name(&name) {\n            bail!(\"agent name '{name}' must contain only letters, numbers, '.', '_', or '-'\");\n        }\n        let Some(program) = config.program.map(|s| s.trim().to_string()) else {\n            bail!(\"agent '{name}' must set `program`\");\n        };\n        if program.is_empty() {\n            bail!(\"agent '{name}' must set a non-empty `program`\");\n        }\n        if let Some(interval) = &config.start_calendar_interval {\n            interval.validate(&name)?;\n        }\n        for dir in &config.queue_directories {\n            if dir.trim().is_empty() {\n                bail!(\"agent '{name}' `queue_directories` must not contain empty entries\");\n            }\n            // checked against the raw string rather than `Path::is_absolute` on the\n            // expanded value: the plist is consumed by macOS launchd, so POSIX rules\n            // apply regardless of the platform parsing the config, and on Windows\n            // `Path::new(\"/var/spool\").is_absolute()` is false (root, but no prefix)\n            if !is_absolute_launchd_path(dir) {\n                bail!(\n                    \"agent '{name}' `queue_directories` entry '{dir}' must be an absolute path \\\n                     (launchd requires absolute paths; `~` and `~/` are expanded)\"\n                );\n            }","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/system/launchd.rs#L92-L128","documentation":"A launchd agent's program value is trimmed before validation; if what remains is empty (program = \"\" or only whitespace), LaunchdRequest::from_toml rejects it with this error and the agent is skipped. This is distinct from the missing-key error: the key is present but carries no usable executable path.","triggerScenarios":"Writing program = \"\" or program = \"   \" in [bootstrap.macos.launchd.agents.<name>], or a templating placeholder that renders to whitespace.","commonSituations":"Placeholder values left from scaffolding; templates where the program variable is undefined and expands to empty; accidental whitespace from copy-paste or trailing newlines in generated TOML.","solutions":["Set program to a real absolute path, e.g. program = \"/usr/local/bin/sync\"","If the agent is intentionally disabled, remove the whole agent table instead of blanking program","Check templated configs render a non-empty path (mise exec -- templating dry-run or render the file once)"],"exampleFix":"# before\n[bootstrap.macos.launchd.agents.sync]\nprogram = \"\"\n\n# after\n[bootstrap.macos.launchd.agents.sync]\nprogram = \"/usr/local/bin/sync\"","handlingStrategy":"validation","validationCode":"python3 - <<'EOF'\nimport tomllib,sys\nc=tomllib.load(open('mise.toml','rb'))\nfor name,agent in (c.get('bootstrap',{}).get('macos',{}).get('launchd',{}).get('agents',{}) or {}).items():\n    p=agent.get('program')\n    if isinstance(p,str) and not p.strip(): sys.exit(f'agent {name} has empty program')\nEOF","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never leave placeholder empty program values; remove the agent table instead","Render templated configs once and grep for 'program = \"\"' before shipping","Remember the value is trimmed — whitespace-only is treated as empty"],"tags":["mise","macos","launchd","bootstrap","empty-value"],"backgroundTag":"config-validation-failed","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}