{"record":{"id":"75f3d0ea203f5d98","repo":"BoundaryML/baml","slug":"future-short-circuited-above","errorCode":null,"errorMessage":"Future short-circuited above","messagePattern":"Future short-circuited above","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/bex_vm/src/package_baml/root.rs","lineNumber":882,"sourceCode":"                    // no GC write barrier because it is all in gen0\n                    *vm.get_object_mut(placeholder_ptr) = Object::Instance(new_instance);\n                    placeholder_ptr\n                }\n\n                // Bigint is behind Arc — clone() is cheap (increments refcount).\n                Object::Bigint(arc) => vm.tlab.alloc(Object::Bigint(std::sync::Arc::clone(&arc))),\n                Object::Function(f) => vm.tlab.alloc(Object::Function(f)),\n                Object::Interface(i) => vm.tlab.alloc(Object::Interface(i)),\n                Object::Package(p) => vm.tlab.alloc(Object::Package(p)),\n                Object::ImplRule(r) => vm.tlab.alloc(Object::ImplRule(r)),\n                Object::Class(c) => vm.tlab.alloc(Object::Class(c)),\n                Object::Enum(e) => vm.tlab.alloc(Object::Enum(e)),\n                Object::TypeAlias(a) => vm.tlab.alloc(Object::TypeAlias(a)),\n                Object::Variant(v) => vm.tlab.alloc(Object::Variant(v)),\n                Object::RustData(arc) => vm.tlab.alloc(Object::RustData(Arc::clone(&arc))),\n                // `Object::Future(_)` is short-circuited above; it can't\n                // reach this match arm.\n                Object::Future(_) => unreachable!(\"Future short-circuited above\"),\n                Object::UnscheduledFuture(f) => vm.tlab.alloc(Object::UnscheduledFuture(f)),\n                // A deep copy denotes the same type: clone the `TypeValue`\n                // whole, definition overlay and owner edge included.\n                Object::Type(ty) => vm.tlab.alloc(Object::Type(ty)),\n                // Closures, bound methods, and cells are shallow-copied: the captured\n                // state is shared by design (mutation semantics).\n                Object::Closure(c) => vm.tlab.alloc(Object::Closure(c)),\n                Object::BoundMethod(bm) => vm.tlab.alloc(Object::BoundMethod(bm)),\n                Object::GenericFunction(gf) => vm.tlab.alloc(Object::GenericFunction(gf)),\n                // `HostClosure` is a value-type wrapper around an\n                // `Arc<HostValueArc>`; cloning the Arc is cheap and matches\n                // the closure semantics (shared handle).\n                Object::HostClosure(hc) => vm.tlab.alloc(Object::HostClosure(hc)),\n                Object::Cell(cell) => vm.tlab.alloc(Object::Cell(cell)),\n                #[cfg(feature = \"heap_debug\")]\n                Object::Sentinel(kind) => vm.tlab.alloc(Object::Sentinel(kind)),\n            };\n","sourceCodeStart":864,"sourceCodeEnd":900,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_vm/src/package_baml/root.rs#L864-L900","documentation":"A defensive `unreachable!` in deep_copy_value_recursive: `Object::Future` values are supposed to be short-circuited earlier in the deep-copy routine and never reach this match arm. Hitting it means the pre-match short-circuit logic failed to intercept a Future.","triggerScenarios":"Calling deep_copy on a value graph containing a Future whose representation reaches the recursive match without being caught by the earlier Future short-circuit branch (e.g. a Future wrapped in an unhandled container or an unscheduled/derived Future variant).","commonSituations":"Deep-copying structures that hold futures (async results stored in objects/arrays); VM changes that introduce new Future-like variants without updating the short-circuit; VM bugs.","solutions":["Avoid deep-copying values that contain pending Futures; resolve/await them first.","Update to the latest VM version where Future handling in deep_copy may be fixed.","Report to maintainers — the short-circuit invariant was violated."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// avoid deep-copying values containing futures\nfunction containsFuture(v) { return v && (v.type === 'Future' || (Array.isArray(v) && v.some(containsFuture))); }","typeGuard":"function isCopyable(v) { return v == null || v.type !== 'Future'; }","tryCatchPattern":null,"preventionTips":["Resolve/await futures before deep-copying their containers.","Keep VM versions up to date.","Avoid storing futures inside deeply copied data structures."],"tags":["vm-panic","invariant","deep-copy","future"],"backgroundTag":"internal-invariant-violation","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"}