{"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":118,"sourceCode":"\n#[derive(Debug, Clone, PartialEq, Eq)]\npub(crate) struct LaunchdStatus {\n    pub request: LaunchdRequest,\n    pub path: PathBuf,\n    pub loaded: bool,\n    pub state: LaunchdState,\n}\n\nimpl LaunchdRequest {\n    pub(crate) 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 config.keep_alive && config.keep_alive_on_failure {\n            bail!(\"agent '{name}' cannot set both `keep_alive` and `keep_alive_on_failure`\");\n        }\n        if config.nice.is_some_and(|nice| !(-20..=20).contains(&nice)) {\n            bail!(\"agent '{name}' `nice` must be between -20 and 20\");\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)","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/launchd.rs#L100-L136","documentation":"After reading `program`, LaunchdRequest::from_toml trims it and rejects an empty result. A program consisting solely of whitespace would produce an invalid launchd plist executable, so it bails with this message. It complements the missing-`program` check by catching present-but-empty values.","triggerScenarios":"Setting program = \"\" or program = \"   \" (whitespace only) in an agent config, or passing an empty program string programmatically.","commonSituations":"Placeholder values left during templating (e.g. program = \"${BIN}\" where the variable expands empty); clearing a value by blanking it instead of removing the agent; quoting mistakes leaving an empty string.","solutions":["Set `program` to the actual executable path or command","Remove the agent entirely if no program is intended","If using templated values, ensure the template renders to a non-empty path"],"exampleFix":"# before\n[agent.backup]\nprogram = \"\"\n# after\n[agent.backup]\nprogram = \"/usr/local/bin/backup.sh\"","handlingStrategy":"validation","validationCode":"prog = agent_cfg.get(\"program\", \"\")\nif not prog.strip():\n    raise ValueError(f\"agent '{name}' program is empty\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Trim and check program before writing configs","Fail templating early when variables expand to empty strings","Delete unused agents rather than blanking them"],"tags":["launchd","config","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"}