astrid-runtime/astrid · error · InviteStoreError

invite store schema {} is newer than supported schema {STORE

Error message

invite store schema {} is newer than supported schema {STORE_SCHEMA_VERSION}

What it means

The invite store TOML carries a `schema_version` field. If the file's version is greater than `STORE_SCHEMA_VERSION` supported by this build, the library refuses to load it rather than misinterpreting a newer format, wrapping the message in `io::ErrorKind::InvalidData`.

Source

Thrown at crates/astrid-kernel/src/invite/mod.rs:543

            Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(Vec::new()),
            Err(e) => return Err(InviteStoreError::Io(e)),
        };
        let text = std::str::from_utf8(&bytes).map_err(|e| {
            InviteStoreError::Io(std::io::Error::new(std::io::ErrorKind::InvalidData, e))
        })?;
        if text.trim().is_empty() {
            if let Err(error) = self.save_to_disk(&[]) {
                warn!(
                    path = %self.path.display(),
                    %error,
                    "could not normalize empty invite store"
                );
            }
            return Ok(Vec::new());
        }
        let probe: SchemaProbe = toml::from_str(text).map_err(InviteStoreError::Toml)?;
        if probe.schema_version > STORE_SCHEMA_VERSION {
            return Err(InviteStoreError::Io(std::io::Error::new(
                std::io::ErrorKind::InvalidData,
                format!(
                    "invite store schema {} is newer than supported schema {STORE_SCHEMA_VERSION}",
                    probe.schema_version
                ),
            )));
        }
        let parsed: PersistedFile = toml::from_str(text).map_err(InviteStoreError::Toml)?;
        if probe.schema_version == 0 {
            let invalidated = parsed.invite.len();
            self.save_to_disk(&[])?;
            warn!(
                path = %self.path.display(),
                invalidated,
                "invalidated legacy SHA-256 invite-token store"
            );
            return Ok(Vec::new());
        }

View on GitHub (pinned to affd8760f4)

Solutions

  1. Upgrade the application to a build supporting the store's schema version.
  2. Back up and remove the store file to start fresh, then re-create invites.
  3. Check the schema version in the TOML before swapping binaries between versions.

Example fix

# before (downgraded binary)
schema_version = 5
# after: upgrade binary, or if starting fresh
rm .astrid/invites.toml
Defensive patterns

Strategy: try-catch

Validate before calling

let probe: toml::Value = toml::from_str(&std::fs::read_to_string(store_path)?)?;
if probe["schema_version"].as_integer().unwrap_or(0) > SUPPORTED_SCHEMA_VERSION {
    eprintln!("invite store written by newer version; upgrade before use");
}

Try / catch

match store.load() {
    Err(InviteStoreError::Io(e))
        if e.kind() == std::io::ErrorKind::InvalidData
            && e.to_string().contains("newer than supported") =>
    {
        eprintln!("upgrade the application or archive this store file");
        return Err(e.into());
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling `load` → `load_from_disk` after the store file was written by a newer version of the tool whose `schema_version` exceeds the compiled-in `STORE_SCHEMA_VERSION`.

Common situations: Downgrading the astrid binary after a newer version upgraded the invite store; sharing a state directory between machines with different versions; restoring a backup from a newer release.

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 astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/3a21445851bc67ad. Report an issue: GitHub.