{"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/533346cc374382b41ec5ff70536252b2e96e725c/src/system/user_services.rs#L269-L305","documentation":"mise rejects a user service request whose name appears more than once in the [bootstrap] config: during `requests_from_config`, after checking systemd units it checks launchd agents and bails if the same service name is already declared there. Each user service must be declared exactly once so the apply step produces a single unambiguous install/remove request.","triggerScenarios":"Calling requests_from_config (during `mise` bootstrap/service apply) with a config where the same service name is listed both in [bootstrap.linux.systemd.units] and in [bootstrap.macos.launchd.agents], or duplicated across platform sections that are both present on the current machine.","commonSituations":"Users copying an existing service block into the other platform's section while syncing mac/linux config files, or sharing one mise.toml between machines and keeping the service in both sections instead of guarding with platform-specific files.","solutions":["Search your mise.toml files for the service name and delete the duplicate declaration, keeping only the platform-appropriate one","Move platform-specific service blocks into platform-scoped config (e.g. mise.toml under [settings] platform overrides or separate files per OS)","Rename one of the services if they are genuinely different services"],"exampleFix":"// before\n[bootstrap.linux.systemd.units]\n[[bootstrap.linux.systemd.units]]\nname = \"my-daemon\"\n[[bootstrap.macos.launchd.agents]]\nname = \"my-daemon\"\n\n// after\n# keep only the section for the current platform\n[[bootstrap.macos.launchd.agents]]\nname = \"my-daemon\"","handlingStrategy":"validation","validationCode":"// shell: ensure the service appears in only one bootstrap section\ngrep -rn \"name = \\\"my-daemon\\\"\" ~/.config/mise .mise.toml mise.toml 2>/dev/null\n# must match in either systemd.units or launchd.agents, never both","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep service declarations in platform-scoped config files, one per OS","Grep for the service name across all mise.toml files before adding a new declaration","Treat systemd units and launchd agents as the same logical namespace in your config reviews"],"tags":["config","user-services","duplicate-declaration"],"backgroundTag":"conflicting-config-options","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"}