{"record":{"id":"704b449d56d7901a","repo":"jdx/mise","slug":"expected-second-calendar-interval-dictionary-got","errorCode":null,"errorMessage":"expected second calendar interval dictionary, got {value:?}","messagePattern":"expected second calendar interval dictionary, got (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/launchd.rs","lineNumber":875,"sourceCode":"            Value::Dictionary(dict) => dict,\n            value => panic!(\"expected dictionary, got {value:?}\"),\n        };\n        match dict.get(\"StartCalendarInterval\") {\n            Some(Value::Array(intervals)) => {\n                assert_eq!(intervals.len(), 2);\n                match &intervals[0] {\n                    Value::Dictionary(interval) => {\n                        assert_eq!(interval.get(\"Hour\"), Some(&Value::Integer(3.into())));\n                        assert_eq!(interval.get(\"Minute\"), Some(&Value::Integer(0.into())));\n                    }\n                    value => panic!(\"expected first calendar interval dictionary, got {value:?}\"),\n                }\n                match &intervals[1] {\n                    Value::Dictionary(interval) => {\n                        assert_eq!(interval.get(\"Hour\"), Some(&Value::Integer(12.into())));\n                        assert_eq!(interval.get(\"Weekday\"), Some(&Value::Integer(1.into())));\n                    }\n                    value => panic!(\"expected second calendar interval dictionary, got {value:?}\"),\n                }\n            }\n            value => panic!(\"expected StartCalendarInterval array, got {value:?}\"),\n        }\n        assert_eq!(dict.get(\"ThrottleInterval\"), None);\n        assert_eq!(dict.get(\"QueueDirectories\"), None);\n    }\n\n    #[test]\n    fn test_render_plist_throttle_and_queue_directories() {\n        let request = LaunchdRequest::from_toml(\n            \"sync\".to_string(),\n            LaunchdTomlConfig {\n                program: Some(\"/bin/echo\".to_string()),\n                throttle_interval: Some(10),\n                nice: None,\n                queue_directories: vec![\n                    \"~/Library/Queues/sync\".to_string(),","sourceCodeStart":857,"sourceCodeEnd":893,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/launchd.rs#L857-L893","documentation":"Test assertion panic in test_render_plist_multiple_calendar_intervals. The test requires the second StartCalendarInterval entry to be a dictionary with Hour=12 and Weekday=1; if intervals[1] is not a dictionary, this catch-all arm panics with the actual value.","triggerScenarios":"render_plist emits the second calendar interval as a non-dictionary, or emits only one interval so the surrounding array match has already failed differently; here specifically intervals[1] has the wrong type.","commonSituations":"Changes to interval serialization that flatten scalar-only intervals (e.g. weekday-only schedules) into non-dict plist values.","solutions":["Inspect intervals[1] in the {value:?} panic payload","Ensure every StartCalendarInterval element is serialized as a plist dictionary even when it only has Hour/Weekday keys","Fix render_plist or update the test to match the intended schema"],"exampleFix":"// before\nvalue => panic!(\"expected second calendar interval dictionary, got {value:?}\"),\n// after\n// intervals[1] must be Value::Dictionary with Hour=12, Weekday=1","handlingStrategy":"validation","validationCode":"let second = intervals.get(1)\n    .unwrap_or_else(|| panic!(\"missing second interval\"));\nassert!(matches!(second, Value::Dictionary(_)), \"second interval not dict: {second:?}\");","typeGuard":"fn as_interval(v: &Value) -> Option<&PlistDictionary> {\n    match v { Value::Dictionary(d) if d.contains_key(\"Hour\") => Some(d), _ => None }\n}","tryCatchPattern":null,"preventionTips":["Serialize every interval as a dictionary regardless of which keys it has","Assert interval count before indexing to distinguish missing vs malformed elements"],"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-14T05:17:10.506Z"}