Description
When a Durable Object method throws an Error whose message contains non-ASCII characters (e.g. Chinese UTF-8), wrangler dev displays garbled/corrupted text in the terminal.
Steps to reproduce
- Create a Durable Object with a method that throws an Error with Chinese characters:
class MyDO extends DurableObject {
myMethod() {
throw new Error("RESOURCE_NOT_FOUND|->资源不存在");
}
}
- Call this method via RPC (the caller catches the error properly via
mightFail / try-catch)
- Observe the terminal output in
wrangler dev
Expected behavior
✘ [ERROR] RESOURCE_NOT_FOUND|->资源不存在 Error
at myMethod (file:///path/to/file.ts:3:11)
Actual behavior
✘ [ERROR] ᆲ唕饞몐Ѐ Error
at value (file:///path/to/file.ts:3:11)
The error message is garbled — Chinese UTF-8 bytes are displayed as wrong Unicode codepoints. The ASCII Error suffix at the end displays correctly.
Other examples of garbled output observed:
ꨠۥ詠齙 (should be a validation error message)
귕嚏对琀 (should be a duplicate name error message)
Analysis
The garbled characters are NOT the result of simple latin1 or UTF-16LE misinterpretation of UTF-8 bytes (we verified this). It appears to be a deeper encoding issue in workerd's C++ error logging layer.
Notes
- The RPC error propagation works correctly — the caller receives the full error message with proper encoding
- This is purely a display issue in
wrangler dev terminal output
- Only affects the
✘ [ERROR] log lines that workerd prints for exceptions in DO methods
- ASCII-only error messages display correctly
Environment
- wrangler 4.99.0
- macOS (Darwin 25.4.0)
- Terminal: zsh with UTF-8 locale
Description
When a Durable Object method throws an Error whose
messagecontains non-ASCII characters (e.g. Chinese UTF-8),wrangler devdisplays garbled/corrupted text in the terminal.Steps to reproduce
mightFail/ try-catch)wrangler devExpected behavior
Actual behavior
The error message is garbled — Chinese UTF-8 bytes are displayed as wrong Unicode codepoints. The ASCII
Errorsuffix at the end displays correctly.Other examples of garbled output observed:
ꨠۥ詠齙(should be a validation error message)귕嚏对琀(should be a duplicate name error message)Analysis
The garbled characters are NOT the result of simple latin1 or UTF-16LE misinterpretation of UTF-8 bytes (we verified this). It appears to be a deeper encoding issue in workerd's C++ error logging layer.
Notes
wrangler devterminal output✘ [ERROR]log lines that workerd prints for exceptions in DO methodsEnvironment