Description
Version
23.7.0
Platform
Darwin Apples-MacBook-Pro.local 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
- Run a script that involves debugging, breakpoints, or function scope evaluation
- Observe the crash with the fatal error
How often does it reproduce? Is there a required condition?
The issue reproduces consistently when running a script that involves debugging, particularly with breakpoints, function scope evaluation, or closures.
What is the expected behavior? Why is that the expected behavior?
The debugger should pause execution at the debugger; statement and allow the user to inspect variables within the function's scope without causing a crash or becoming unresponsive.
What do you see instead?
I encountered a fatal error while running Node.js v23.7.0, leading to a crash with the following message:
Fatal error in , line 0
Check failed: needs_context && current_scope_ == closure_scope_ && current_scope_->is_function_scope() && !function_.is_null() implies function_->context() != *context_.
Additional information
Complete Error log trace if required
Fatal error in , line 0
Check failed: needs_context && current_scope_ == closure_scope_ && current_scope_->is_function_scope() && !function_.is_null() implies function_->context() != *context_.
#FailureMessage Object: 0x16bc90698
----- Native stack trace -----
1: 0x1044899ac node::NodePlatform::GetStackTracePrinter()::$_0::__invoke() [/opt/homebrew/Cellar/node/23.6.1/bin/node]
2: 0x104f00f88 V8_Fatal(char const*, ...) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
3: 0x1046b264c v8::internal::ScopeIterator::start_position() [/opt/homebrew/Cellar/node/23.6.1/bin/node]
4: 0x1046b2fec v8::internal::ScopeIterator::VisitLocalScope(std::__1::function<bool (v8::internal::Handlev8::internal::String, v8::internal::Handlev8::internal::Object, v8::internal::ScopeIterator::ScopeType)> const&, v8::internal::ScopeIterator::Mode, v8::internal::ScopeIterator::ScopeType) const [/opt/homebrew/Cellar/node/23.6.1/bin/node]
5: 0x1046b254c v8::internal::ScopeIterator::ScopeObject(v8::internal::ScopeIterator::Mode) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
6: 0x104aa2fb0 v8_inspector::V8DebuggerAgentImpl::currentCallFrames(std::__1::unique_ptr<std::__1::vector<std::__1::unique_ptr<v8_inspector::protocol::Debugger::CallFrame, std::__1::default_delete<v8_inspector::protocol::Debugger::CallFrame>>, std::__1::allocator<std::__1::unique_ptr<v8_inspector::protocol::Debugger::CallFrame, std::__1::default_delete<v8_inspector::protocol::Debugger::CallFrame>>>>, std::__1::default_delete<std::__1::vector<std::__1::unique_ptr<v8_inspector::protocol::Debugger::CallFrame, std::__1::default_delete<v8_inspector::protocol::Debugger::CallFrame>>, std::__1::allocator<std::__1::unique_ptr<v8_inspector::protocol::Debugger::CallFrame, std::__1::default_delete<v8_inspector::protocol::Debugger::CallFrame>>>>>>) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
7: 0x104aa280c v8_inspector::V8DebuggerAgentImpl::didPause(int, v8::Localv8::Value, std::__1::vector<int, std::__1::allocator> const&, v8::debug::ExceptionType, bool, v8::base::EnumSet<v8::debug::BreakReason, int>) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
8: 0x104ab56b4 v8_inspector::V8InspectorImpl::forEachSession(int, std::__1::function<void (v8_inspector::V8InspectorSessionImpl)> const&) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
9: 0x104aaaa40 v8_inspector::V8Debugger::handleProgramBreak(v8::Localv8::Context, v8::Localv8::Value, std::__1::vector<int, std::__1::allocator> const&, v8::base::EnumSet<v8::debug::BreakReason, int>, v8::debug::ExceptionType, bool) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
10: 0x1046ba754 v8::internal::Debug::OnDebugBreak(v8::internal::Handlev8::internal::FixedArray, v8::internal::StepAction, v8::base::EnumSet<v8::debug::BreakReason, int>) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
11: 0x1046ba074 v8::internal::Debug::Break(v8::internal::JavaScriptFrame*, v8::internal::Handlev8::internal::JSFunction) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
12: 0x104a214c4 v8::internal::Runtime_DebugBreakOnBytecode(int, unsigned long*, v8::internal::Isolate*) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
13: 0x10420fc74 Builtins_CEntry_Return2_ArgvOnStack_NoBuiltinExit [/opt/homebrew/Cellar/node/23.6.1/bin/node]
14: 0x1042e0368 Builtins_DebugBreak3Handler [/opt/homebrew/Cellar/node/23.6.1/bin/node]
15: 0x104178838 Builtins_InterpreterEntryTrampoline [/opt/homebrew/Cellar/node/23.6.1/bin/node]
16: 0x1041b5e20 Builtins_AsyncFunctionAwaitResolveClosure [/opt/homebrew/Cellar/node/23.6.1/bin/node]
17: 0x104283298 Builtins_PromiseFulfillReactionJob [/opt/homebrew/Cellar/node/23.6.1/bin/node]
18: 0x1041a5214 Builtins_RunMicrotasks [/opt/homebrew/Cellar/node/23.6.1/bin/node]
19: 0x1041763f0 Builtins_JSRunMicrotasksEntry [/opt/homebrew/Cellar/node/23.6.1/bin/node]
20: 0x1046f2718 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
21: 0x1046f2e84 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
22: 0x10471d438 v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
23: 0x10417a978 Builtins_CallApiCallbackGeneric [/opt/homebrew/Cellar/node/23.6.1/bin/node]
24: 0x12818bbdc
25: 0x10417650c Builtins_JSEntryTrampoline [/opt/homebrew/Cellar/node/23.6.1/bin/node]
26: 0x1041761b0 Builtins_JSEntry [/opt/homebrew/Cellar/node/23.6.1/bin/node]
27: 0x1046f2740 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
28: 0x1046f20a8 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object, int, v8::internal::Handlev8::internal::Object) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
29: 0x1045d73bc v8::Function::Call(v8::Isolate, v8::Localv8::Context, v8::Localv8::Value, int, v8::Localv8::Value) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
30: 0x1043316d4 node::InternalCallbackScope::Close() [/opt/homebrew/Cellar/node/23.6.1/bin/node]
31: 0x104331b94 node::InternalMakeCallback(node::Environment, v8::Localv8::Object, v8::Localv8::Object, v8::Localv8::Function, int, v8::Localv8::Value, node::async_context, v8::Localv8::Value) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
32: 0x104349c9c node::AsyncWrap::MakeCallback(v8::Localv8::Function, int, v8::Localv8::Value) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
33: 0x10451c37c node::StreamBase::CallJSOnreadMethod(long, v8::Localv8::ArrayBuffer, unsigned long, node::StreamBase::StreamBaseJSChecks) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
34: 0x10451c600 node::EmitToJSStreamListener::OnStreamRead(long, uv_buf_t const&) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
35: 0x104522b40 node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
36: 0x104522848 node::LibuvStreamWrap::ReadStart()::$_1::__invoke(uv_stream_s*, long, uv_buf_t const*) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
37: 0x107a9ae6c uv__stream_io [/opt/homebrew/Cellar/libuv/1.50.0/lib/libuv.1.dylib]
38: 0x107aa20e0 uv__io_poll [/opt/homebrew/Cellar/libuv/1.50.0/lib/libuv.1.dylib]
39: 0x107a91f08 uv_run [/opt/homebrew/Cellar/libuv/1.50.0/lib/libuv.1.dylib]
40: 0x104332488 node::SpinEventLoopInternal(node::Environment*) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
41: 0x10445fef0 node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
42: 0x10445fc44 node::NodeMainInstance::Run() [/opt/homebrew/Cellar/node/23.6.1/bin/node]
43: 0x1043d889c node::Start(int, char**) [/opt/homebrew/Cellar/node/23.6.1/bin/node]
44: 0x183ba0274 start [/usr/lib/dyld]