{"record":{"id":"09965c834ab136b7","repo":"Hmbown/CodeWhale","slug":"thread-not-found","errorCode":null,"errorMessage":"thread {} not found","messagePattern":"thread (.+?) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/state/src/lib.rs","lineNumber":840,"sourceCode":"        )\n        .optional()\n        .context(\"failed to read thread memory mode\")\n        .map(Option::flatten)\n    }\n\n    /// Insert or replace the persisted goal for a thread.\n    pub fn upsert_thread_goal(&self, goal: &ThreadGoalRecord) -> Result<()> {\n        let conn = self.conn()?;\n        let exists: Option<i64> = conn\n            .query_row(\n                \"SELECT 1 FROM threads WHERE id = ?1\",\n                params![goal.thread_id],\n                |row| row.get(0),\n            )\n            .optional()\n            .context(\"failed to verify thread before saving goal\")?;\n        if exists.is_none() {\n            anyhow::bail!(\"thread {} not found\", goal.thread_id);\n        }\n\n        conn.execute(\n            r#\"\n            INSERT INTO thread_goals (\n                thread_id, goal_id, objective, status, token_budget, tokens_used,\n                time_used_seconds, continuation_count, created_at, updated_at\n            ) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10)\n            ON CONFLICT(thread_id) DO UPDATE SET\n                goal_id=excluded.goal_id,\n                objective=excluded.objective,\n                status=excluded.status,\n                token_budget=excluded.token_budget,\n                tokens_used=excluded.tokens_used,\n                time_used_seconds=excluded.time_used_seconds,\n                continuation_count=excluded.continuation_count,\n                created_at=excluded.created_at,\n                updated_at=excluded.updated_at","sourceCodeStart":822,"sourceCodeEnd":858,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/state/src/lib.rs#L822-L858","documentation":"Error \"thread {} not found\" thrown in Hmbown/CodeWhale.","triggerScenarios":"Thrown at crates/state/src/lib.rs:840 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}