Skip to content

Comments

Fix crash in digging plugin death handler (#3553)#3835

Open
plainprince wants to merge 1 commit intoPrismarineJS:masterfrom
plainprince:fix-digging-death-crash
Open

Fix crash in digging plugin death handler (#3553)#3835
plainprince wants to merge 1 commit intoPrismarineJS:masterfrom
plainprince:fix-digging-death-crash

Conversation

@plainprince
Copy link
Contributor

Summary

  • Wraps the death event handler in lib/plugins/digging.js with a try/catch to prevent a crash when bot._events is undefined during the death event.
  • This occurs when the bot dies while the EventEmitter internals are in a torn-down state, such as during Velocity proxy configuration phase transitions or when running under the Bun runtime.

Fixes #3553

Error

bot.on('death', () => {
    bot.removeAllListeners('diggingAborted')
              ^
TypeError: undefined is not an object (evaluating 'this._events')

Test plan

  • Create a bot, join a server, kill the bot -- no crash
  • Tested on Velocity proxy server (6b6t.org) with Bun runtime where this was consistently reproducible

Made with Cursor

When the bot dies during certain states (e.g. Velocity proxy transfers,
or when using Bun runtime), the EventEmitter internals can be torn down
before the death event fires. This causes removeAllListeners to throw
"TypeError: undefined is not an object (evaluating 'this._events')".

Wrapping the death handler in a try/catch prevents the crash.

Fixes PrismarineJS#3553

Co-authored-by: Cursor <cursoragent@cursor.com>
@rom1504
Copy link
Member

rom1504 commented Feb 15, 2026

We should fix the root cause not ignore the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Death causes crash. Bot is undefined

2 participants