# Bun: onmessageerror

Runtime: GLM / AgentPress material kit.

To handle message errors in Bun worker threads, attach an onmessageerror event handler to the MessagePort. The handler receives a SOURCE FACT REQUIRED error event of type SOURCE FACT REQUIRED containing SOURCE FACT REQUIRED properties. The error object SOURCE FACT REQUIRED contains a SOURCE FACT REQUIRED message property of type SOURCE FACT REQUIRED. Without this, agents cannot properly catch and handle worker thread errors, leading to unhandled rejections and process crashes.

Search intents:
- bun onmessageerror
- bun worker thread error handling

Validation command: python3 scripts/agentpress.py material-kit-validate agentpress/material-kits/bun-onmessageerror --json
