{"record":{"id":"447ffacd123cdc8b","repo":"jdx/mise","slug":"service-unit-name-has-invalid-nice-value-ni","errorCode":null,"errorMessage":"service unit '{name}' has invalid `nice` value {nice}; expected -20 through 19","messagePattern":"service unit '(.+?)' has invalid `nice` value (.+?); expected -20 through 19","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/systemd.rs","lineNumber":221,"sourceCode":"                    \"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        {\n            bail!(\"service unit '{name}' has invalid `nice` value {nice}; expected -20 through 19\");\n        }\n        if let Some(umask) = &config.umask\n            && !valid_umask(umask)\n        {\n            bail!(\n                \"service unit '{name}' has invalid `umask` value '{umask}'; expected an octal access mask from 0000 through 0777\"\n            );\n        }\n        let wanted_by = config.wanted_by.unwrap_or_else(|| match kind {\n            SystemdUnitKind::Service => vec![\"default.target\".to_string()],\n            SystemdUnitKind::Timer => vec![\"timers.target\".to_string()],\n        });\n        Ok(Self {\n            unit: format!(\n                \"dev.mise.{name}.{}\",\n                match kind {\n                    SystemdUnitKind::Service => \"service\",\n                    SystemdUnitKind::Timer => \"timer\",","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/systemd.rs#L203-L239","documentation":"from_toml validates the optional `nice` priority against the OS range -20 (highest priority) through 19 (lowest). Values outside this range would be rejected by systemd/setpriority anyway, so mise fails fast at config parse time.","triggerScenarios":"Setting nice in a systemd unit's TOML config in mise.toml to any integer not in -20..=19 (e.g. nice = 20 or nice = -21) and loading the config via SystemdRequest::from_toml.","commonSituations":"Confusing nice range with the -20..20 exclusive bound; using a Unix priority value from another tool with a different convention; off-by-one typos like -25.","solutions":["Change nice to a value between -20 and 19 inclusive (lower = higher priority)","Remember values below 0 usually require root; pick >= 0 for unprivileged units","Remove the nice key if prioritization is not needed"],"exampleFix":"# before (mise.toml)\n[systemd.\"worker.service\"]\nexec_start = \"/usr/bin/worker\"\nnice = 20\n# after\n[systemd.\"worker.service\"]\nexec_start = \"/usr/bin/worker\"\nnice = 19","handlingStrategy":"validation","validationCode":"fn valid_nice(n: i32) -> bool { (-20..=19).contains(&n) }\n// check before writing nice into the unit config","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember nice range is -20..=19 inclusive; 19 is the lowest priority","Use non-negative nice values for unprivileged units","Clamp or validate user-provided priorities before persisting config"],"tags":["systemd","validation","nice","range","config"],"backgroundTag":"value-out-of-range","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"}