{"record":{"id":"76f0a4f2801489bc","repo":"jdx/mise","slug":"agent-name-name-must-contain-only-letters-num","errorCode":null,"errorMessage":"agent name '{name}' must contain only letters, numbers, '.', '_', or '-'","messagePattern":"agent name '(.+?)' must contain only letters, numbers, '\\.', '_', or '-'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/launchd.rs","lineNumber":112,"sourceCode":"pub(crate) enum LaunchdState {\n    Loaded,\n    Unloaded,\n    Differs,\n    Missing,\n}\n\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() {","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/launchd.rs#L94-L130","documentation":"LaunchdRequest::from_toml in src/system/launchd.rs validates agent names with valid_name() before building a launchd agent request. Names may only contain letters, digits, '.', '_', and '-' because the name becomes part of the launchd plist label and filename. Any other character (space, slash, colon, etc.) causes this error.","triggerScenarios":"Defining a launchd agent whose [agent.NAME] key or name argument contains characters outside [A-Za-z0-9._-], e.g. spaces, '/', '@', or unicode.","commonSituations":"Naming an agent after a full path ('/usr/local/mytool'); using spaces in agent names; deriving names from URLs or tool names with '@' scope separators.","solutions":["Rename the agent using only letters, numbers, '.', '_', or '-'","Replace spaces with '-' or '_' in the agent section key","Strip path or URL components from the name and keep only a short identifier"],"exampleFix":"# before\n[agent.\"my tool\"]\nprogram = \"/usr/bin/tool\"\n# after\n[agent.\"my-tool\"]\nprogram = \"/usr/bin/tool\"","handlingStrategy":"validation","validationCode":"import re\nassert re.fullmatch(r\"[A-Za-z0-9._-]+\", name), f\"invalid agent name: {name}\"","typeGuard":"const isValidAgentName = (n) => /^[A-Za-z0-9._-]+$/.test(n);","tryCatchPattern":null,"preventionTips":["Use short kebab-case agent names","Strip path/URL characters from generated names","Validate names in CI before deploying agent configs"],"tags":["launchd","config","naming"],"backgroundTag":"invalid-identifier-format","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"}