{"record":{"id":"6def0ec2230ef4d1","repo":"openai/codex","slug":"built-in-pinned-thread-section-cannot-be-deleted","errorCode":null,"errorMessage":"built-in pinned thread section cannot be deleted","messagePattern":"built-in pinned thread section cannot be deleted","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/state/src/runtime/thread_sections.rs","lineNumber":68,"sourceCode":"            .map(|appearance| serde_json::to_string(&appearance))\n            .transpose()?;\n        let section = sqlx::query_as::<_, (String, String, Option<String>)>(\n            \"UPDATE thread_sections SET name = ?, appearance = CASE WHEN ? THEN ? ELSE appearance END WHERE id = ? RETURNING id, name, appearance\",\n        )\n        .bind(name)\n        .bind(replace_appearance)\n        .bind(appearance)\n        .bind(id)\n        .fetch_optional(self.pool.as_ref())\n        .await?;\n\n        section.map(ThreadSection::from_row).transpose()\n    }\n\n    /// Delete a custom section and return its threads to the unsectioned list.\n    pub async fn delete_thread_section(&self, id: &str) -> anyhow::Result<bool> {\n        if id == PINNED_THREAD_SECTION_ID {\n            anyhow::bail!(\"built-in pinned thread section cannot be deleted\");\n        }\n\n        let mut tx = self.pool.begin_with(\"BEGIN IMMEDIATE\").await?;\n        sqlx::query(\n            \"UPDATE threads SET section_position = NULL, section_entered_at_ms = NULL WHERE thread_section_id = ?\",\n        )\n        .bind(id)\n        .execute(&mut *tx)\n        .await?;\n\n        let deleted = sqlx::query(\"DELETE FROM thread_sections WHERE id = ?\")\n            .bind(id)\n            .execute(&mut *tx)\n            .await?\n            .rows_affected()\n            > 0;\n        tx.commit().await?;\n","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/state/src/runtime/thread_sections.rs#L50-L86","documentation":"Error \"built-in pinned thread section cannot be deleted\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/state/src/runtime/thread_sections.rs:68 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"}