{"record":{"id":"5ed7052219855606","repo":"astrid-runtime/astrid","slug":"unknown-astrid-volume-operation","errorCode":null,"errorMessage":"unknown Astrid volume operation","messagePattern":"unknown Astrid volume operation","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage/src/volume/hosted/mod.rs","lineNumber":455,"sourceCode":"    Remove = 4,\n    Rename = 5,\n    Replace = 6,\n    MetadataTransaction = 7,\n    Commit = 8,\n}\n\nimpl Operation {\n    fn decode(value: u8) -> io::Result<Self> {\n        match value {\n            1 => Ok(Self::Create),\n            2 => Ok(Self::Write),\n            3 => Ok(Self::Truncate),\n            4 => Ok(Self::Remove),\n            5 => Ok(Self::Rename),\n            6 => Ok(Self::Replace),\n            7 => Ok(Self::MetadataTransaction),\n            8 => Ok(Self::Commit),\n            _ => Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                \"unknown Astrid volume operation\",\n            )),\n        }\n    }\n}\n\nfn apply_metadata_mutations(\n    regions: &mut BTreeMap<VolumeRegion, RegionState>,\n    mutations: &[VolumeMetadataMutation],\n) -> io::Result<()> {\n    for mutation in mutations {\n        match mutation {\n            VolumeMetadataMutation::Rename {\n                source,\n                destination,\n            } => {\n                if regions.contains_key(destination) {","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage/src/volume/hosted/mod.rs#L437-L473","documentation":"Volume operation opcodes are decoded from a single byte on the wire; only 1..=8 are defined (Truncate, Remove, Rename, Replace, MetadataTransaction, Commit, etc.). decode maps any other byte to InvalidData. This indicates a corrupted, truncated-shifted, or written-by-a-newer-version record stream.","triggerScenarios":"Reading a volume record whose operation byte is 0 or >8 — e.g. a corrupted record, misaligned offset in the record stream, or a volume written by a newer library version with extra opcodes.","commonSituations":"Version skew: a volume file created by a newer astrid-storage release is opened by an older binary; disk corruption or a torn write landing in the opcode byte; decoding a byte stream at the wrong offset so a length field is read as the opcode.","solutions":["Ensure the same or newer version of astrid-storage reads the volume — check for version skew between writer and reader.","Verify the record offset passed to decode is the actual start of a record (opcode byte first), not mid-record.","Run the volume recovery path (recover_container) to resynchronize to a valid commit header.","Restore the volume from backup if the record stream is physically corrupted."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match VolumeOperation::decode(byte) {\n    Ok(op) => apply(op),\n    Err(e) if e.kind() == io::ErrorKind::InvalidData => {\n        // log offset + bytes, run recovery, fail fast on version skew\n        recover_container(file)?;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep writer and reader astrid-storage versions in lockstep.","Never decode at hand-computed offsets; use the library's record iterator.","Enable checksum/recovery validation when opening volumes from untrusted media."],"tags":["storage","serialization","corruption","versioning"],"backgroundTag":"invalid-enum-value","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}