{"record":{"id":"64a6d0a676f24016","repo":"atuinsh/atuin","slug":"unexpected-number-of-fields-nfields-for-histor","errorCode":null,"errorMessage":"unexpected number of fields ({nfields}) for history version {version}","messagePattern":"unexpected number of fields \\((.+?)\\) for history version (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin-client/src/history.rs","lineNumber":297,"sourceCode":"        Ok(DecryptedData(output.into_vec()))\n    }\n\n    pub fn deserialize(bytes: &[u8], version: &str) -> Result<History> {\n        let Some(version) = Version::from_name(version) else {\n            bail!(\"unknown version {version:?}\");\n        };\n\n        let mut bytes = Bytes::new(bytes);\n\n        let real_version = decode::read_u16(&mut bytes).map_err(DecodeError::from)?;\n        if real_version != version.as_int() {\n            bail!(\"expected to decode {version} record, found v{real_version}\");\n        }\n\n        let nfields = decode::read_array_len(&mut bytes).map_err(DecodeError::from)?;\n        let min_fields = version.min_fields();\n        if nfields < min_fields || version.max_fields().is_some_and(|max| nfields > max) {\n            bail!(\"unexpected number of fields ({nfields}) for history version {version}\");\n        }\n\n        let id = decode::read_string(&mut bytes)?;\n        let timestamp = decode::read_u64(&mut bytes).map_err(DecodeError::from)?;\n        let duration = decode::read_int(&mut bytes).map_err(DecodeError::from)?;\n        let exit = decode::read_int(&mut bytes).map_err(DecodeError::from)?;\n\n        let command = decode::read_string(&mut bytes)?;\n        let cwd = decode::read_string(&mut bytes)?;\n        let session = decode::read_string(&mut bytes)?;\n        let hostname = decode::read_string(&mut bytes)?;\n        let deleted_at = decode::read_optional(&mut bytes, decode::read_u64)?;\n\n        let author = if version >= Version::One {\n            decode::read_optional(&mut bytes, decode::read_string)?\n        } else {\n            None\n        };","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/atuinsh/atuin/blob/15fe1318f1df51de604262eb50734c9883d48e7b/crates/atuin-client/src/history.rs#L279-L315","documentation":"Error \"unexpected number of fields ({nfields}) for history version {version}\" thrown in atuinsh/atuin.","triggerScenarios":"Fires when a serialized history record has a field count inconsistent with its declared version.","commonSituations":"See trigger scenarios.","solutions":["The encoded history record is malformed or from an incompatible version; upgrade atuin or rebuild the store."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"15fe1318f1df51de604262eb50734c9883d48e7b","analyzedAt":"2026-08-19T08:56:57.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}