#36832·deno

RUST_BACKTRACE=1 prints a useless Rust stack backtrace on ordinary `deno test` failures

Author: steve02081504Created Sep 14, 2026Updated Sep 16, 2026

Summary

With RUST_BACKTRACE=1 set in the environment, any failing deno test run prints a Rust stack backtrace, even when the failure is a plain JavaScript assertion/throw and there is no Rust panic involved.

After the normal test report, Deno emits:

error: Test failed

Stack backtrace:
   0: llhttp_get_error_reason
   1: aws_lc_0_40_0_jent_entropy_switch_notime_impl
   2: uv_mutex_unlock
   ...
  10: BaseThreadInitThunk
  11: RtlUserThreadStart

These frames are the CLI's top-level Rust main-thread frames and are unrelated to the failing test. On release builds the symbols are mangled/meaningless (see above), so the backtrace has zero diagnostic value and is pure noise in CI logs.

Reproduction

fail.test.ts:

Deno.test('fails', () => {
	throw new Error('boom')
})
RUST_BACKTRACE=1 deno test fail.test.ts

Expected

A JavaScript test failure should print the JS error and exit non-zero — no Rust backtrace. RUST_BACKTRACE should only affect output when a Rust panic actually occurs.

Actual

error: Test failed is followed by the Rust Stack backtrace: shown above.

Version

deno 2.9.6+336da42 (canary, release, x86_64-pc-windows-msvc)
v8 15.0.245.2-rusty
typescript 6.0.3

OS: Windows 11 (x86_64)

Notes

  • RUST_BACKTRACE=1 is commonly set globally by users and CI images to debug panics; it should not turn ordinary test failures into backtrace dumps.
  • Likely cause: the generic error: Test failed exit path (the CLI's top-level error/exit) is routed through the same anyhow/ExitCode machinery whose Display/termination honors RUST_BACKTRACE, instead of only the panic hook doing so.
  • Suggestion: only emit a Rust backtrace from the panic hook; for regular CLI errors (Test failed and friends), suppress the Stack backtrace: section regardless of RUST_BACKTRACE.