{"record":{"id":"eff1e19779ed0424","repo":"jdx/mise","slug":"timer-unit-name-cannot-set-service-only-direct","errorCode":null,"errorMessage":"timer unit '{name}' cannot set service-only directive(s): {}","messagePattern":"timer unit '(.+?)' cannot set service-only directive\\(s\\): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/systemd.rs","lineNumber":202,"sourceCode":"                (config.timeout_start_sec.is_some(), \"timeout_start_sec\"),\n                (config.timeout_stop_sec.is_some(), \"timeout_stop_sec\"),\n                (config.no_new_privileges.is_some(), \"no_new_privileges\"),\n                (config.private_tmp.is_some(), \"private_tmp\"),\n                (!config.environment.is_empty(), \"environment\"),\n                (!config.environment_file.is_empty(), \"environment_file\"),\n                (config.nice.is_some(), \"nice\"),\n                (config.umask.is_some(), \"umask\"),\n                (config.working_directory.is_some(), \"working_directory\"),\n                (config.restart.is_some(), \"restart\"),\n                (config.restart_sec.is_some(), \"restart_sec\"),\n                (config.standard_output.is_some(), \"standard_output\"),\n                (config.standard_error.is_some(), \"standard_error\"),\n            ]\n            .into_iter()\n            .filter_map(|(is_set, field)| is_set.then_some(field))\n            .collect::<Vec<_>>();\n            if !service_only_fields.is_empty() {\n                bail!(\n                    \"timer unit '{name}' cannot set service-only directive(s): {}\",\n                    service_only_fields.join(\", \")\n                );\n            }\n            if config.on_boot_sec.is_none()\n                && config.on_unit_active_sec.is_none()\n                && config.on_unit_inactive_sec.is_none()\n                && config.on_calendar.is_none()\n            {\n                bail!(\n                    \"timer unit '{name}' must set at least one of `on_boot_sec`, \\\n                     `on_unit_active_sec`, `on_unit_inactive_sec`, or `on_calendar`\"\n                );\n            }\n        }\n        if let Some(nice) = config.nice\n            && !(-20..=19).contains(&nice)\n        {","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/systemd.rs#L184-L220","documentation":"When from_toml classifies a unit as a Timer (because a scheduling key is present), service-only directives such as exec_start, type, remain_after_exit, standard_output/standard_error, etc. are not allowed on it. The error lists exactly which offending fields were set, since systemd defines those on the paired service unit, not the timer.","triggerScenarios":"Defining a timer unit in mise.toml that sets both a schedule key (on_boot_sec / on_unit_active_sec / on_unit_inactive_sec / on_calendar / randomized_delay_sec) and one or more service-only fields (exec_start, type, remain_after_exit, standard_output, standard_error, ...).","commonSituations":"Copy-pasting a service block and adding on_calendar to it; misunderstanding that mise generates the timer/service pair automatically; trying to configure the service's stdout through the timer entry.","solutions":["Remove the listed service-only directives from the timer entry — mise generates the paired service unit itself","If you need exec_start and its options, split into two entries: a timer entry (schedule only) and a service entry (exec_start etc.)","Check each named field in the error message and delete it from the timer's TOML table"],"exampleFix":"# before (mise.toml)\n[systemd.\"backup.timer\"]\non_calendar = \"daily\"\nexec_start = \"/usr/bin/backup\"\n# after\n[systemd.\"backup.timer\"]\non_calendar = \"daily\"","handlingStrategy":"validation","validationCode":"const SERVICE_ONLY: &[&str] = &[\"exec_start\",\"type\",\"remain_after_exit\",\"standard_output\",\"standard_error\"];\n// reject timer entries that set any of these","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep timer entries to scheduling keys only (on_calendar, on_boot_sec, randomized_delay_sec)","Split timer+service needs into two separate mise.toml unit entries","Mise generates the paired service automatically — do not duplicate its directives"],"tags":["systemd","validation","timer","config"],"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"}