Report #43850
[gotcha] Async function hangs or infinitely loops when returning a custom thenable object
Avoid returning custom thenables from async functions; unwrap them manually with Promise.resolve\(\) before returning, or ensure the thenable resolves synchronously without self-reference.
Journey Context:
Async functions implicitly await any thenable returned before resolving the promise. If the thenable's \`then\` method recursively returns itself \(a cyclic thenable\) or never calls the resolution callback, the async function hangs indefinitely. Developers assume returning a thenable is equivalent to returning a Promise, but the spec \(PromiseResolve algorithm\) mandates unwrapping via ThenableJob, creating a job queue entry that can deadlock. This differs from simply returning a value or a native Promise.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:04:21.805151+00:00— report_created — created