{"record":{"id":"b8b85c918b0dc2ff","repo":"jdx/mise","slug":"task-action-manifest-baseline-was-not-loaded","errorCode":null,"errorMessage":"task action manifest baseline was not loaded","messagePattern":"task action manifest baseline was not loaded","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"crates/mise-cache-core/src/agent.rs","lineNumber":501,"sourceCode":"        for task in tasks {\n            if let Err(error) = task.await {\n                warn!(\"remote action prefetch task failed: {error}\");\n            }\n        }\n    }\n\n    /// Atomically publish the candidate manifest collected by a successful task.\n    pub async fn commit_task(&self, run: &str) -> Result<()> {\n        validate_task_identity(run)?;\n        let state = self\n            .task_actions\n            .lock()\n            .unwrap()\n            .get(run)\n            .cloned()\n            .ok_or_else(|| eyre::eyre!(\"task action manifest baseline was not loaded\"))?;\n        if !state.baseline_loaded {\n            bail!(\"task action manifest baseline was not loaded\");\n        }\n        let task = state.manifest;\n        validate_task_identity(&task)?;\n        let manifest = {\n            let _write_guard = self.manifest_write_lock.lock().unwrap();\n            let _file_guard = self.lock_task_manifest(&task)?;\n            let mut predictions = self\n                .load_task_manifest(&task)?\n                .map(|manifest| {\n                    manifest\n                        .predictions\n                        .into_iter()\n                        .map(|prediction| (prediction.invocation.clone(), prediction))\n                        .collect::<BTreeMap<_, _>>()\n                })\n                .unwrap_or_default();\n            predictions.extend(state.predictions);\n            let manifest = TaskActionManifest {","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/crates/mise-cache-core/src/agent.rs#L483-L519","documentation":"Agent::commit_task(run) publishes the manifest collected during a task run. The run token must have been minted by begin_task on the SAME Agent instance, which inserts a TaskActionState with baseline_loaded=true keyed by the run digest; commit fails when no state exists for that run (the eyre branch) or the baseline flag was never set.","triggerScenarios":"Calling commit_task with a run string that was never returned by begin_task (fabricated, truncated, from a previous process, or from a different Agent instance); agent restart between begin_task and commit; calling commit twice after the entry was removed.","commonSituations":"Persisting run tokens to disk and replaying them after a daemon restart; multiplexing several clients over one agent and swapping run tokens; unit tests calling commit_task without a begin_task prologue.","solutions":["Call begin_task(task) first and pass the exact run string it returned to commit_task","Keep begin/commit inside one process lifetime; after a restart, call begin_task again to mint a fresh run token","Sanity-check the token shape: run ids are 64-char lowercase hex (blake3 digests); anything else was never issued by this agent"],"exampleFix":"// before\nagent.commit_task(\"run-1\").await?;\n// after\nlet run = agent.begin_task(&task_id).await?;\n// ... run task, record predictions ...\nagent.commit_task(&run).await?;","handlingStrategy":"validation","validationCode":"// Treat begin_task as the mandatory prologue; never fabricate or persist run tokens\nlet run = agent.begin_task(&task_id).await?; // mints and registers the baseline\nassert_eq!(run.len(), 64); // run tokens are blake3 hex digests","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass the begin_task return value opaquely to commit_task — never construct or mutate it","Scope begin/commit to one process lifetime; re-run begin_task after any restart","In tests, always pair commit_task with a prior begin_task"],"tags":["mise-cache","task-manifest","session-state","lifecycle"],"backgroundTag":"session-state-not-initialized","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}