{"record":{"id":"3a21445851bc67ad","repo":"astrid-runtime/astrid","slug":"invite-store-schema-is-newer-than-supported-sch","errorCode":null,"errorMessage":"invite store schema {} is newer than supported schema {STORE_SCHEMA_VERSION}","messagePattern":"invite store schema (.+?) is newer than supported schema (.+?)","errorType":"validation","errorClass":"InviteStoreError","httpStatus":null,"severity":"error","filePath":"crates/astrid-kernel/src/invite/mod.rs","lineNumber":543,"sourceCode":"            Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(Vec::new()),\n            Err(e) => return Err(InviteStoreError::Io(e)),\n        };\n        let text = std::str::from_utf8(&bytes).map_err(|e| {\n            InviteStoreError::Io(std::io::Error::new(std::io::ErrorKind::InvalidData, e))\n        })?;\n        if text.trim().is_empty() {\n            if let Err(error) = self.save_to_disk(&[]) {\n                warn!(\n                    path = %self.path.display(),\n                    %error,\n                    \"could not normalize empty invite store\"\n                );\n            }\n            return Ok(Vec::new());\n        }\n        let probe: SchemaProbe = toml::from_str(text).map_err(InviteStoreError::Toml)?;\n        if probe.schema_version > STORE_SCHEMA_VERSION {\n            return Err(InviteStoreError::Io(std::io::Error::new(\n                std::io::ErrorKind::InvalidData,\n                format!(\n                    \"invite store schema {} is newer than supported schema {STORE_SCHEMA_VERSION}\",\n                    probe.schema_version\n                ),\n            )));\n        }\n        let parsed: PersistedFile = toml::from_str(text).map_err(InviteStoreError::Toml)?;\n        if probe.schema_version == 0 {\n            let invalidated = parsed.invite.len();\n            self.save_to_disk(&[])?;\n            warn!(\n                path = %self.path.display(),\n                invalidated,\n                \"invalidated legacy SHA-256 invite-token store\"\n            );\n            return Ok(Vec::new());\n        }","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/invite/mod.rs#L525-L561","documentation":"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`.","triggerScenarios":"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`.","commonSituations":"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.","solutions":["Upgrade the application to a build supporting the store's schema version.","Back up and remove the store file to start fresh, then re-create invites.","Check the schema version in the TOML before swapping binaries between versions."],"exampleFix":"# before (downgraded binary)\nschema_version = 5\n# after: upgrade binary, or if starting fresh\nrm .astrid/invites.toml","handlingStrategy":"try-catch","validationCode":"let probe: toml::Value = toml::from_str(&std::fs::read_to_string(store_path)?)?;\nif probe[\"schema_version\"].as_integer().unwrap_or(0) > SUPPORTED_SCHEMA_VERSION {\n    eprintln!(\"invite store written by newer version; upgrade before use\");\n}","typeGuard":null,"tryCatchPattern":"match store.load() {\n    Err(InviteStoreError::Io(e))\n        if e.kind() == std::io::ErrorKind::InvalidData\n            && e.to_string().contains(\"newer than supported\") =>\n    {\n        eprintln!(\"upgrade the application or archive this store file\");\n        return Err(e.into());\n    }\n    other => other?,\n}","preventionTips":["Check the schema version before downgrading binaries.","Back up the invite store before version changes.","Keep all machines sharing state on the same application version."],"tags":["schema","versioning","forward-compatibility"],"backgroundTag":"schema-validation-failed","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}