openai/codex · error · anyhow::Error

built-in pinned thread section cannot be deleted

Error message

built-in pinned thread section cannot be deleted

What it means

Error "built-in pinned thread section cannot be deleted" thrown in openai/codex.

Source

Thrown at codex-rs/state/src/runtime/thread_sections.rs:68

            .map(|appearance| serde_json::to_string(&appearance))
            .transpose()?;
        let section = sqlx::query_as::<_, (String, String, Option<String>)>(
            "UPDATE thread_sections SET name = ?, appearance = CASE WHEN ? THEN ? ELSE appearance END WHERE id = ? RETURNING id, name, appearance",
        )
        .bind(name)
        .bind(replace_appearance)
        .bind(appearance)
        .bind(id)
        .fetch_optional(self.pool.as_ref())
        .await?;

        section.map(ThreadSection::from_row).transpose()
    }

    /// Delete a custom section and return its threads to the unsectioned list.
    pub async fn delete_thread_section(&self, id: &str) -> anyhow::Result<bool> {
        if id == PINNED_THREAD_SECTION_ID {
            anyhow::bail!("built-in pinned thread section cannot be deleted");
        }

        let mut tx = self.pool.begin_with("BEGIN IMMEDIATE").await?;
        sqlx::query(
            "UPDATE threads SET section_position = NULL, section_entered_at_ms = NULL WHERE thread_section_id = ?",
        )
        .bind(id)
        .execute(&mut *tx)
        .await?;

        let deleted = sqlx::query("DELETE FROM thread_sections WHERE id = ?")
            .bind(id)
            .execute(&mut *tx)
            .await?
            .rows_affected()
            > 0;
        tx.commit().await?;

View on GitHub (pinned to 339751715c)

When it happens

Trigger: Thrown at codex-rs/state/src/runtime/thread_sections.rs:68 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/6def0ec2230ef4d1. Report an issue: GitHub.