{"record":{"id":"bc693dffc07a0228","repo":"BoundaryML/baml","slug":"value-int-payload-i-is-outside-the-i63-range-pre-tagged","errorCode":null,"errorMessage":"Value::Int payload {i} is outside the i63 range [{}, {}]; pre-tagged-pointer payloads with |value| >= 2^62 cannot be loaded","messagePattern":"Value::Int payload (.+?) is outside the i63 range \\[(.+?), (.+?)\\]; pre-tagged-pointer payloads with \\|value\\| >= 2\\^62 cannot be loaded","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/bex_vm_types/src/types/value.rs","lineNumber":538,"sourceCode":"        let proxy = match self.kind() {\n            ValueKind::Null => ValueWire::Null,\n            ValueKind::OmittedArg => ValueWire::OmittedArg,\n            ValueKind::Int(i) => ValueWire::Int(i),\n            ValueKind::Bool(b) => ValueWire::Bool(b),\n            ValueKind::Object(ptr) => ValueWire::Object(ptr),\n        };\n        proxy.serialize(writer)\n    }\n}\n\nimpl BorshDeserialize for Value {\n    fn deserialize_reader<R: std::io::Read>(reader: &mut R) -> std::io::Result<Self> {\n        let proxy = ValueWire::deserialize_reader(reader)?;\n        Ok(match proxy {\n            ValueWire::Null => Value::NULL,\n            ValueWire::OmittedArg => Value::OMITTED_ARG,\n            ValueWire::Int(i) => Value::try_int(i).ok_or_else(|| {\n                std::io::Error::new(\n                    std::io::ErrorKind::InvalidData,\n                    format!(\n                        \"Value::Int payload {i} is outside the i63 range [{}, {}]; \\\n                         pre-tagged-pointer payloads with |value| >= 2^62 cannot be loaded\",\n                        Value::INT_MIN,\n                        Value::INT_MAX,\n                    ),\n                )\n            })?,\n            ValueWire::Bool(b) => Value::bool(b),\n            ValueWire::Object(ptr) => Value::object(ptr),\n        })\n    }\n}\n","sourceCodeStart":520,"sourceCodeEnd":553,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_vm_types/src/types/value.rs#L520-L553","documentation":"During deserialization, a ValueWire::Int payload is converted back to Value::Int via Value::try_int, which only accepts values fitting the i63 range ([-2^62, 2^62-1]) used by the tagged-pointer representation. Older wire payloads (pre-tagged-pointer) may contain full i64 integers whose magnitude reaches 2^62 or beyond; these cannot be represented as a tagged Value and are rejected with InvalidData instead of silently wrapping.","triggerScenarios":"Deserializing (deserialize_reader / from-bytes style entry points in bex_vm_types Value) a wire blob produced by an older BAML runtime whose Int payloads were full i64, where any payload has |value| >= 2^62 (i.e. <= Value::INT_MIN or >= Value::INT_MAX out of range).","commonSituations":"Loading persisted VM state, caches, or IPC messages written by an older bex_vm_types version into a newer tagged-pointer runtime; cross-version compatibility between a producer binary and a consumer binary; test fixtures with extreme sentinel-like i64 constants (i64::MIN/MAX).","solutions":["Regenerate the serialized data with the current runtime version so Int payloads fit the i63 range.","Clamp or remap out-of-range integers before serialization on the producer side, or store them as BigInt/BigIntWire when |value| >= 2^62.","Upgrade/downgrade so producer and consumer use the same tagged-pointer representation version.","If exact huge values must survive, extend ValueWire with a wide-int variant and migrate the writer to emit it."],"exampleFix":"// before\nValueWire::Int(big_i64_value) // written by old runtime, |v| >= 2^62\n// after (producer)\nlet wire = if big_i64_value.unsigned_abs() >= 1u64 << 62 {\n    ValueWire::BigInt(big_i64_value.into())\n} else {\n    ValueWire::Int(big_i64_value)\n};","handlingStrategy":"validation","validationCode":"// producer-side check before serializing an Int payload\nfn fits_i63(v: i64) -> bool {\n    v >= Value::INT_MIN && v <= Value::INT_MAX\n}","typeGuard":null,"tryCatchPattern":"// Rust consumer\nlet value = Value::deserialize_reader(&mut reader)\n    .map_err(|e| if e.kind() == std::io::ErrorKind::InvalidData {\n        MyError::LegacyIntPayload(e.to_string())\n    } else {\n        MyError::Io(e)\n    })?;","preventionTips":["Regenerate cached/persisted wire blobs after upgrading bex_vm_types to the tagged-pointer layout.","Keep producer and consumer on matching runtime versions; stamp a version header into serialized blobs.","Route huge integers (>=(2^62) magnitude) to a wide-int representation before serializing."],"tags":["serialization","rust","int-overflow","backwards-compatibility"],"backgroundTag":"value-out-of-range","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}