Hmbown/CodeWhale · error

Task schema v is newer than supported v

Error message

Task schema v{} is newer than supported v{}

What it means

While enumerating durable task files, each record's schema_version is compared with CURRENT_TASK_SCHEMA_VERSION. A record written by a newer version of the app cannot be safely decoded or migrated by this process, so it fails loudly per-file instead of silently dropping or misinterpreting fields.

Solutions

  1. Upgrade this installation to a version supporting the record's schema_version
  2. Move the newer-version task files out of this store's directory
  3. Use a separate task-store directory per app version to avoid mixed-version state

Example fix

// before: old binary reading new store
$ codewhale-1.2 --task-store ~/.codewhale/tasks  // schema v3 > supported v2
// after
$ codewhale-1.3 --task-store ~/.codewhale/tasks
Defensive patterns

Strategy: fallback

Validate before calling

let record: TaskRecord = serde_json::from_str(&content)?;
if record.schema_version > CURRENT_TASK_SCHEMA_VERSION {
    eprintln!("skip {}: schema v{} > supported v{}", path.display(), record.schema_version, CURRENT_TASK_SCHEMA_VERSION);
}

Type guard

fn readable_version(record: &TaskRecord, supported: u32) -> bool { record.schema_version <= supported }

Try / catch

match manager.load_task_file(&path).await {
    Err(e) if e.to_string().contains("newer than supported") => {
        eprintln!("upgrade required; skipping {path:?}");
        // fall back to a read-only inventory or an upgraded binary
    }
    other => other?,
}

Prevention

When it happens

Trigger: Scanning/loading the tasks directory after downgrading the app, or after another newer instance wrote task files with a higher schema_version.

Common situations: Downgrade after an upgrade; two installs of different versions sharing one task store; synced/roamed state directory carrying records from a newer machine.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/66b0a38fc93567e8. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/task_manager.rs:3162

}

fn load_state(tasks_dir: &Path, queue_path: &Path) -> Result<LoadedTaskState> {
    let mut tasks = HashMap::new();
    if tasks_dir.exists() {
        for entry in fs::read_dir(tasks_dir)
            .with_context(|| format!("Failed to read tasks dir {}", tasks_dir.display()))?
        {
            let entry = entry?;
            let path = entry.path();
            if path.extension().is_none_or(|ext| ext != "json") {
                continue;
            }
            let content = fs::read_to_string(&path)
                .with_context(|| format!("Failed to read task file {}", path.display()))?;
            let task: TaskRecord = serde_json::from_str(&content)
                .with_context(|| format!("Failed to parse task file {}", path.display()))?;
            if task.schema_version > CURRENT_TASK_SCHEMA_VERSION {
                bail!(
                    "Task schema v{} is newer than supported v{}",
                    task.schema_version,
                    CURRENT_TASK_SCHEMA_VERSION
                );
            }
            ensure_safe_storage_id("task id", &task.id)?;
            if path.file_stem().and_then(|stem| stem.to_str()) != Some(task.id.as_str()) {
                bail!("Task record identity differs from its path");
            }
            if let Some(scope) = &task.execution_scope {
                validate_execution_id(scope, 64)?;
            }
            if let Some(generation) = &task.execution_generation {
                validate_execution_id(generation, 32)?;
                if task.execution_scope.is_none() {
                    bail!("Task generation has no execution scope");
                }
            }

View on GitHub (pinned to 73e0f67d83)