{"record":{"id":"d06c35e3d1e81995","repo":"Hmbown/CodeWhale","slug":"a-pinned-automation-provider-requires-an-explicit-model","errorCode":null,"errorMessage":"A pinned automation provider requires an explicit model","messagePattern":"A pinned automation provider requires an explicit model","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":1245,"sourceCode":"    }\n\n    pub fn get_automation(&self, id: &str) -> Result<AutomationRecord> {\n        let path = self.automation_path(id)?;\n        read_automation_file(&path)\n    }\n\n    pub fn save_automation(&self, record: &AutomationRecord) -> Result<()> {\n        self.with_transaction(|| self.save_automation_unlocked(record))\n    }\n\n    fn save_automation_unlocked(&self, record: &AutomationRecord) -> Result<()> {\n        if record.model_provider.is_some() || record.model_provider_id.is_some() {\n            if record\n                .model\n                .as_deref()\n                .is_none_or(|model| model.trim().is_empty())\n            {\n                bail!(\"A pinned automation provider requires an explicit model\");\n            }\n            let mut record = record.clone();\n            record.schema_version = record.schema_version.max(CURRENT_AUTOMATION_SCHEMA_VERSION);\n            return write_json_atomic(&self.automation_path(&record.id)?, &record);\n        }\n        write_json_atomic(&self.automation_path(&record.id)?, record)\n    }\n\n    pub fn list_automations(&self) -> Result<Vec<AutomationRecord>> {\n        let mut out = Vec::new();\n        for entry in fs::read_dir(&self.automations_dir)\n            .with_context(|| format!(\"Failed to read {}\", self.automations_dir.display()))?\n        {\n            let entry = entry?;\n            let path = entry.path();\n            if path.extension().is_none_or(|ext| ext != \"json\") {\n                continue;\n            }","sourceCodeStart":1227,"sourceCodeEnd":1263,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L1227-L1263","documentation":"save_automation validation: a record that pins a model provider (model_provider or model_provider_id set) must also carry an explicit model; a pinned provider without a model is rejected so scheduled runs can never resolve to an arbitrary default model.","triggerScenarios":"Thrown at crates/tui/src/automation_manager.rs:1245 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set an explicit model on the automation record before saving when a model provider (or provider id) is pinned.","Clear model_provider/model_provider_id if the automation should fall back to the default route."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T06:17:15.046Z"}