Hmbown/CodeWhale · error · io::Error

unsupported legacy spillover ownership schema

Error message

unsupported legacy spillover ownership schema

What it means

The legacy spillover ownership sidecar parsed successfully, but its schema_version field does not match LEGACY_SPILLOVER_OWNER_SCHEMA_VERSION. The library refuses to interpret an ownership sidecar written by an unknown schema version rather than guess at its layout.

Solutions

  1. Check the sidecar's schema_version value and compare it against the expected constant in truncate.rs
  2. Upgrade or downgrade Codewhale to the version matching the sidecar's schema
  3. Delete the stale sidecar and let the current version recreate it via its migration path
  4. Manually migrate the sidecar's schema_version if you know the format is otherwise compatible

Example fix

// before: hard failure on version mismatch
let ownership = read_legacy_spillover_ownership(&sidecar)?;
// after: treat unsupported schema as absent and re-migrate
let ownership = read_legacy_spillover_ownership(&sidecar)
    .or_else(|e| {
        if e.kind() == io::ErrorKind::InvalidData {
            recreate_sidecar(&sidecar)
        } else {
            Err(e)
        }
    })?;
Defensive patterns

Strategy: validation

Validate before calling

let v: serde_json::Value = serde_json::from_reader(std::fs::File::open(&sidecar)?)?;
if v.get("schema_version") != Some(&serde_json::json!(LEGACY_SPILLOVER_OWNER_SCHEMA_VERSION)) {
    // migrate or recreate the sidecar before calling the reader
}

Type guard

fn sidecar_matches_schema(v: &serde_json::Value) -> bool {
    v.get("schema_version").and_then(|s| s.as_u64()) == Some(LEGACY_SPILLOVER_OWNER_SCHEMA_VERSION)
}

Prevention

When it happens

Trigger: Reading a sidecar whose JSON schema_version differs from the compile-time LEGACY_SPILLOVER_OWNER_SCHEMA_VERSION constant — typically a file written by a newer or older build.

Common situations: Downgrading the binary after a schema bump; multiple Codewhale versions sharing the same home directory; a stale sidecar left over from a migration that was never completed.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/tools/truncate.rs:174

}

pub(crate) fn read_legacy_spillover_ownership(
    payload_path: &Path,
) -> io::Result<LegacySpilloverOwnership> {
    let sidecar = legacy_spillover_ownership_path(payload_path);
    if std::fs::symlink_metadata(&sidecar)?
        .file_type()
        .is_symlink()
    {
        return Err(io::Error::new(
            io::ErrorKind::PermissionDenied,
            "legacy spillover ownership sidecar must not be a symlink",
        ));
    }
    let ownership = serde_json::from_slice::<LegacySpilloverOwnership>(&std::fs::read(sidecar)?)
        .map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;
    if ownership.schema_version != LEGACY_SPILLOVER_OWNER_SCHEMA_VERSION {
        return Err(io::Error::new(
            io::ErrorKind::InvalidData,
            "unsupported legacy spillover ownership schema",
        ));
    }
    Ok(ownership)
}

/// Resolve the spillover-file path for a SHA256 content hash. Separate
/// namespace (`sha_<hex>.txt`) from the tool-call-id files so legacy
/// SHA-addressed evidence can be recognized without colliding with
/// tool-call references. Retrieval still requires matching ownership
/// metadata. `sha` must be the raw 64-char lowercase hex digest —
/// case-insensitive matching is done by the caller.
#[must_use]
pub fn sha_spillover_path(sha: &str) -> Option<PathBuf> {
    let sha = sha.trim().to_ascii_lowercase();
    if !is_valid_sha256(&sha) {
        return None;

View on GitHub (pinned to 73e0f67d83)