openai/codex · error · anyhow::Error

unknown thread goal status

Error message

unknown thread goal status `{other}`

What it means

TryFrom<&str> for ThreadGoalStatus encountered a status string that does not match any known variant (active, paused, blocked, usage_limited, budget_limited, complete). It fires when deserializing a thread goal status persisted by a newer or older codex version, or from corrupted state-DB data.

Solutions

  1. Upgrade the codex version to one that knows the new status string
  2. Fix or reset the stored goal status in the state DB to a known value
  3. Clear the thread's goal so it is re-created with a valid status
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/state/src/model/thread_goal.rs:55 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/261747b4718a76b1. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/state/src/model/thread_goal.rs:55

    }

    pub fn is_terminal(self) -> bool {
        matches!(self, Self::BudgetLimited | Self::Complete)
    }
}

impl TryFrom<&str> for ThreadGoalStatus {
    type Error = anyhow::Error;

    fn try_from(value: &str) -> Result<Self> {
        match value {
            "active" => Ok(Self::Active),
            "paused" => Ok(Self::Paused),
            "blocked" => Ok(Self::Blocked),
            "usage_limited" => Ok(Self::UsageLimited),
            "budget_limited" => Ok(Self::BudgetLimited),
            "complete" => Ok(Self::Complete),
            other => Err(anyhow!("unknown thread goal status `{other}`")),
        }
    }
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ThreadGoal {
    pub thread_id: ThreadId,
    pub goal_id: String,
    pub objective: String,
    pub status: ThreadGoalStatus,
    pub token_budget: Option<i64>,
    pub tokens_used: i64,
    pub time_used_seconds: i64,
    pub created_at: DateTime<Utc>,
    pub updated_at: DateTime<Utc>,
}

pub(crate) struct ThreadGoalRow {

View on GitHub (pinned to 339751715c)