jdx/mise · error

expected present service

Error message

expected present service

What it means

Let-else panic in the parses_systemctl_properties unit test: parse_inspection of LoadState=loaded/ActiveState=active/UnitFileState=enabled input returned a non-Present ServiceInspection (e.g. Missing). It fires when parse_inspection misclassifies a fully loaded systemd unit as missing or another variant.

Source

Thrown at src/system/services.rs:721

                },
            )
            .is_ok()
        );
    }

    #[test]
    fn parses_systemctl_properties() {
        assert!(matches!(
            parse_inspection("LoadState=not-found\nActiveState=inactive\nUnitFileState=\n"),
            ServiceInspection::Missing
        ));
        let ServiceInspection::Present {
            active_state,
            unit_file_state,
            ..
        } = parse_inspection("LoadState=loaded\nActiveState=active\nUnitFileState=enabled\n")
        else {
            panic!("expected present service")
        };
        assert_eq!(active_state, "active");
        assert_eq!(unit_file_state, "enabled");
    }

    #[test]
    fn plans_service_convergence_and_static_failures() {
        let mut request =
            ServiceRequest::from_toml("docker".to_string(), Default::default()).unwrap();
        request.inspection = Some(ServiceInspection::Present {
            active_state: "active".to_string(),
            unit_file_state: "enabled".to_string(),
            need_daemon_reload: false,
        });
        assert_eq!(request.plan().action, ResourceAction::Noop);
        request.inspection = Some(ServiceInspection::Present {
            active_state: "active".to_string(),
            unit_file_state: "enabled".to_string(),

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Check that parse_inspection only returns Missing when LoadState is not-found or equivalent
  2. Ensure present-state detection reads ActiveState/UnitFileState regardless of trailing empty keys
  3. Rerun parses_systemctl_properties after adjusting the systemd property parser
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at src/system/services.rs:721 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/68183c40c059bdf1. Report an issue: GitHub.