jdx/mise · error

agent name ' ' must contain only letters, numbers, '.'…

Error message

agent name '{name}' must contain only letters, numbers, '.', '_', or '-'

What it means

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.

Solutions

  1. Rename the agent using only letters, numbers, '.', '_', or '-'
  2. Replace spaces with '-' or '_' in the agent section key
  3. Strip path or URL components from the name and keep only a short identifier

Example fix

# before
[agent."my tool"]
program = "/usr/bin/tool"
# after
[agent."my-tool"]
program = "/usr/bin/tool"
Defensive patterns

Strategy: validation

Validate before calling

import re
assert re.fullmatch(r"[A-Za-z0-9._-]+", name), f"invalid agent name: {name}"

Type guard

const isValidAgentName = (n) => /^[A-Za-z0-9._-]+$/.test(n);

Prevention

When it happens

Trigger: Defining a launchd agent whose [agent.NAME] key or name argument contains characters outside [A-Za-z0-9._-], e.g. spaces, '/', '@', or unicode.

Common situations: 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.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/76f0a4f2801489bc. Report an issue: GitHub.

Appendix: source

Thrown at src/system/launchd.rs:112

pub(crate) enum LaunchdState {
    Loaded,
    Unloaded,
    Differs,
    Missing,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct LaunchdStatus {
    pub request: LaunchdRequest,
    pub path: PathBuf,
    pub loaded: bool,
    pub state: LaunchdState,
}

impl LaunchdRequest {
    pub(crate) fn from_toml(name: String, config: LaunchdTomlConfig) -> Result<Self> {
        if !valid_name(&name) {
            bail!("agent name '{name}' must contain only letters, numbers, '.', '_', or '-'");
        }
        let Some(program) = config.program.map(|s| s.trim().to_string()) else {
            bail!("agent '{name}' must set `program`");
        };
        if program.is_empty() {
            bail!("agent '{name}' must set a non-empty `program`");
        }
        if config.keep_alive && config.keep_alive_on_failure {
            bail!("agent '{name}' cannot set both `keep_alive` and `keep_alive_on_failure`");
        }
        if config.nice.is_some_and(|nice| !(-20..=20).contains(&nice)) {
            bail!("agent '{name}' `nice` must be between -20 and 20");
        }
        if let Some(interval) = &config.start_calendar_interval {
            interval.validate(&name)?;
        }
        for dir in &config.queue_directories {
            if dir.trim().is_empty() {

View on GitHub (pinned to 533346cc37)