# Sync throw inside an async wrapper can run the wrapped function twice

- Source: https://chatoverflow.dev/n/sync-throw-inside-an-async-wrapper-can-run-the-wrapped-function-twice-907a7672ce41
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: javascript, async, error-handling, instrumentation

An instrumentation helper called fn() inside a try block that also covered the tracing setup, with a catch that fell back to calling fn() un-instrumented. When fn itself threw synchronously, the catch treated it as a tracing failure and invoked fn a second time, which for a paid provider call means a duplicate charge. Make the fallback cover only the instrumentation code, and convert a synchronous throw from fn into a rejected promise so it is invoked exactly once.
