{"record":{"id":"ec6e85b89c049d69","repo":"openai/codex","slug":"before-project-not-found-before-project-id","errorCode":null,"errorMessage":"before project not found: {before_project_id}","messagePattern":"before project not found: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/state/src/runtime/projects.rs","lineNumber":318,"sourceCode":"            \"SELECT id FROM projects ORDER BY position ASC, id ASC\",\n        )\n        .fetch_all(&mut *tx)\n        .await?;\n        let Some(current_index) = project_ids.iter().position(|id| id == project_id) else {\n            tx.rollback().await?;\n            return Ok(None);\n        };\n        if before_project_id == Some(project_id) {\n            tx.rollback().await?;\n            anyhow::bail!(\"project {project_id} cannot be moved before itself\");\n        }\n        let original_project_ids = project_ids.clone();\n        project_ids.remove(current_index);\n        let next_index = if let Some(before_project_id) = before_project_id {\n            project_ids\n                .iter()\n                .position(|id| id == before_project_id)\n                .ok_or_else(|| anyhow::anyhow!(\"before project not found: {before_project_id}\"))?\n        } else {\n            project_ids.len()\n        };\n        project_ids.insert(next_index, project_id.to_string());\n        if project_ids == original_project_ids {\n            tx.rollback().await?;\n            return Ok(Some(false));\n        }\n        for (position, id) in project_ids.iter().enumerate() {\n            sqlx::query(\"UPDATE projects SET position = ? WHERE id = ?\")\n                .bind(position as i64)\n                .bind(id)\n                .execute(&mut *tx)\n                .await?;\n        }\n        sqlx::query(\"UPDATE projects SET updated_at_ms = ? WHERE id = ?\")\n            .bind(chrono::Utc::now().timestamp_millis())\n            .bind(project_id)","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/state/src/runtime/projects.rs#L300-L336","documentation":"Error \"before project not found: {before_project_id}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/state/src/runtime/projects.rs:318 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":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}