{"record":{"id":"499b1a9fb7c5b04d","repo":"BoundaryML/baml","slug":"snapshot-not-possible-for-type-type-name","errorCode":null,"errorMessage":"Snapshot not possible for type: {type_name}","messagePattern":"Snapshot not possible for type: (.+?)","errorType":"exception","errorClass":"EngineError","httpStatus":null,"severity":"warning","filePath":"baml_language/crates/bex_engine/src/lib.rs","lineNumber":852,"sourceCode":"\n    /// Clean process-termination request from `baml.sys.exit(code)`.\n    /// The caller is expected to honor this as the process exit code.\n    /// BAML `int` is `i64`, so the signal carries the full value; the\n    /// caller clamps into its shell's range (typically 0..=255 on Unix).\n    #[error(\"baml.sys.exit({code})\")]\n    Exit { code: i64 },\n\n    #[error(\"Cannot convert object of type {type_name}\")]\n    CannotConvert { type_name: String },\n\n    #[error(\"Type mismatch: {message}\")]\n    TypeMismatch { message: String },\n\n    #[error(\"Schema inconsistency: {message}\")]\n    SchemaInconsistency { message: String },\n\n    #[cfg(feature = \"heap_debug\")]\n    #[error(\"Snapshot not possible for type: {type_name}\")]\n    CannotSnapshot { type_name: String },\n\n    #[error(\"A function call with ID {call_id} is already in progress\")]\n    DuplicateCallId { call_id: CallId },\n\n    #[error(\"Package initialization failed: {0}\")]\n    InitFailed(String),\n\n    #[error(\"{0}\")]\n    Other(String),\n}\n\nfn format_vm_internal_error(\n    err: &bex_vm::errors::VmInternalError,\n    trace: &[bex_vm::StackFrame],\n) -> String {\n    use std::fmt::Write;\n    let mut out = bex_vm::format_traceback(","sourceCodeStart":834,"sourceCodeEnd":870,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_engine/src/lib.rs#L834-L870","documentation":"Compiled under the heap_debug feature: the debug snapshot machinery cannot snapshot a value of the given BAML type because no snapshot implementation exists for it. It is a diagnostic/feature-gated limitation, not corruption.","triggerScenarios":"Invoking heap-debug snapshot APIs while heap_debug is enabled, on a value whose type lacks a snapshot impl (e.g. certain native or opaque objects).","commonSituations":"Developers debugging VM heap state who snapshot heterogeneous heaps containing unsupported object kinds.","solutions":["Skip snapshotting values of the unsupported type_name and snapshot the rest of the heap","Add a snapshot implementation for that type if it must be captured","Disable heap_debug if snapshots are not needed (also removes this variant)"],"exampleFix":"// conceptual\n// before\nsnapshot(value) // panics for Opaque\n// after\nif snapshot_supported(value) { snapshot(value) } else { skip(value) }","handlingStrategy":"fallback","validationCode":"fn snapshotable(v: &BexExternalValue) -> bool {\n    !matches!(v, BexExternalValue::Opaque(_))\n}","typeGuard":"fn is_opaque(v: &BexExternalValue) -> bool {\n    matches!(v, BexExternalValue::Opaque(_))\n}","tryCatchPattern":"match snapshot(value) {\n    Err(EngineError::CannotSnapshot { type_name }) => {\n        eprintln!(\"skipping {type_name}\");\n    }\n    Ok(s) => store(s),\n    Err(e) => handle(e),\n}","preventionTips":["Check type support before snapshotting heterogeneous heaps","Add snapshot impls for types you routinely debug","Remember this variant only exists with heap_debug enabled"],"tags":["heap-debug","snapshot","feature-gated"],"backgroundTag":"unsupported-operation","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}