{"record":{"id":"917badfcc6b96440","repo":"jdx/mise","slug":"expected-environmentvariables-dictionary-got-val","errorCode":null,"errorMessage":"expected EnvironmentVariables dictionary, got {value:?}","messagePattern":"expected EnvironmentVariables dictionary, got (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/launchd.rs","lineNumber":818,"sourceCode":"                    .to_string_lossy()\n                    .to_string()\n            ))\n        );\n        match dict.get(\"ProgramArguments\") {\n            Some(Value::Array(args)) => {\n                assert_eq!(args[0], Value::String(\"/bin/echo\".to_string()));\n                assert_eq!(args[1], Value::String(\"hello\".to_string()));\n            }\n            value => panic!(\"expected ProgramArguments array, got {value:?}\"),\n        }\n        match dict.get(\"EnvironmentVariables\") {\n            Some(Value::Dictionary(env)) => {\n                assert_eq!(\n                    env.get(\"PATH\"),\n                    Some(&Value::String(\"/usr/bin:/bin\".to_string()))\n                );\n            }\n            value => panic!(\"expected EnvironmentVariables dictionary, got {value:?}\"),\n        }\n        assert!(plist_matches(&plist, &request));\n    }\n\n    #[test]\n    fn test_render_plist_multiple_calendar_intervals() {\n        let request = LaunchdRequest {\n            name: \"sync\".to_string(),\n            label: \"dev.mise.sync\".to_string(),\n            program: \"/bin/echo\".to_string(),\n            args: vec![],\n            run_at_load: false,\n            keep_alive: false,\n            keep_alive_on_failure: false,\n            start_interval: None,\n            throttle_interval: None,\n            nice: None,\n            start_calendar_interval: Some(LaunchdCalendarIntervals::Multiple(vec![","sourceCodeStart":800,"sourceCodeEnd":836,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/launchd.rs#L800-L836","documentation":"Test assertion panic in test_render_plist. The test requires that the plist dictionary rendered by render_plist contains an 'EnvironmentVariables' key holding a dictionary in which PATH equals /usr/bin:/bin. The panic arm runs whenever the key is absent or holds a non-dictionary value, dumping the actual value with {:?}.","triggerScenarios":"render_plist omits 'EnvironmentVariables' from the generated launchd plist, or emits it as a non-dictionary (array/string), so the match on dict.get(\"EnvironmentVariables\") falls through to the catch-all arm.","commonSituations":"Refactoring how environment variables are serialized into the plist, accidentally skipping empty env maps, or renaming the key — all cause this test to panic during cargo test.","solutions":["Inspect the {value:?} payload in the panic to see the actual parsed plist fragment","Check render_plist in src/system/launchd.rs still serializes request.environment as an 'EnvironmentVariables' dictionary","Restore the key or update the test to match the new intended plist schema","Verify the PATH entry survives any env filtering/normalization added to render_plist"],"exampleFix":"// before\nvalue => panic!(\"expected EnvironmentVariables dictionary, got {value:?}\"),\n// after\n// ensure render_plist emits:\n// \"EnvironmentVariables\" => Value::Dictionary(map with \"PATH\" => Value::String(\"/usr/bin:/bin\"))","handlingStrategy":"validation","validationCode":"let env = match dict.get(\"EnvironmentVariables\") {\n    Some(Value::Dictionary(e)) => e,\n    other => panic!(\"EnvironmentVariables missing or wrong type: {other:?}\"),\n};\nassert_eq!(env.get(\"PATH\"), Some(&Value::String(\"/usr/bin:/bin\".into())));","typeGuard":"fn as_dict(v: Option<&Value>) -> Option<&std::collections::HashMap<String, Value>> {\n    match v { Some(Value::Dictionary(d)) => Some(d), _ => None }\n}","tryCatchPattern":null,"preventionTips":["Never serialize empty env maps by omitting the key if tests expect the key present","Cover env serialization in a focused unit test on render_plist","Keep key names as constants shared between serializer and tests"],"tags":["rust","test-assertion","plist","launchd"],"backgroundTag":"unexpected-response-shape","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"}