{"record":{"id":"65b4b9d0251bee3f","repo":"jdx/mise","slug":"user-service-is-also-declared-in-bootstrap-m","errorCode":null,"errorMessage":"user service '{}' is also declared in [bootstrap.macos.launchd.agents]; declare it once","messagePattern":"user service '(.+?)' is also declared in \\[bootstrap\\.macos\\.launchd\\.agents\\]; declare it once","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/user_services.rs","lineNumber":287,"sourceCode":"        .into_iter()\n        .map(|(name, (declaration, origin))| {\n            UserServiceRequest::from_toml(name, declaration, Some(origin))\n        })\n        .collect::<Result<Vec<_>>>()?;\n    if requests.is_empty() {\n        return Ok(requests);\n    }\n    let units = crate::system::systemd_from_config(config);\n    let agents = crate::system::launchd_from_config(config);\n    for request in &requests {\n        if units.iter().any(|unit| unit.name == request.name) {\n            bail!(\n                \"user service '{}' is also declared in [bootstrap.linux.systemd.units]; declare it once\",\n                request.name\n            );\n        }\n        if agents.iter().any(|agent| agent.name == request.name) {\n            bail!(\n                \"user service '{}' is also declared in [bootstrap.macos.launchd.agents]; declare it once\",\n                request.name\n            );\n        }\n    }\n    Ok(requests)\n}\n\n/// The mise executable a service definition may reference: the running\n/// binary unless it lives in a temporary or remote-bootstrap staging\n/// directory, else a `mise` on `PATH` outside those. Durability is judged\n/// by where the binary really is, but the path kept is the one found: a\n/// Homebrew or package-manager symlink survives an upgrade, the versioned\n/// file behind it does not.\npub(crate) fn durable_mise_executable() -> Option<PathBuf> {\n    let current = crate::env::MISE_BIN.clone();\n    if durable_behind(&current) {\n        return Some(current);","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/user_services.rs#L269-L305","documentation":"A user service name may not collide with a launchd agent declared in `[bootstrap.macos.launchd.agents]`. `requests_from_config` fails on the duplicate to avoid two managers fighting over the same service name.","triggerScenarios":"`requests_from_config` finds a user service request whose `name` matches a launchd agent name (src/system/user_services.rs:287).","commonSituations":"Sharing one config file across Linux and macOS and declaring the same service both as a launchd agent and a user service; leftover entries after switching service mechanisms.","solutions":["Keep only one declaration: either the launchd agent or the user service","Rename one if they are truly distinct services"],"exampleFix":"// before\n[[bootstrap.macos.launchd.agents]]\nname = \"my-agent\"\ncommand = \"my-agent\"\n[[bootstrap.macos.user_services]]\nname = \"my-agent\"\ncommand = \"my-agent\"\n\n// after\n[[bootstrap.macos.launchd.agents]]\nname = \"my-agent\"\ncommand = \"my-agent\"","handlingStrategy":"validation","validationCode":"function validateNoLaunchdDupes(cfg) {\n  const agentNames = new Set((cfg.bootstrap?.macos?.launchd?.agents ?? []).map(a => a.name));\n  for (const s of cfg.bootstrap?.macos?.user_services ?? []) {\n    if (agentNames.has(s.name)) throw new Error(`user service '${s.name}' duplicates a launchd agent`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When sharing config across macOS/Linux, declare each service once per host-appropriate mechanism","Grep for the service name across all bootstrap tables before adding entries"],"tags":["config","duplicate","launchd","macos","user-services"],"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-14T00:17:10.932Z"}