Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

An unhandled promise rejection is silently ignored and the run exits 0

Closed
#1,295 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
javascript

Research direction

Reproduce the shown Promise.reject script with GocciaRunner in both --mode=interpreted and --mode=bytecode, then read the GocciaRunner, GocciaTestRunner, and runScript entry points, including sandbox behavior. Done means unhandled rejections are reported with a failing result in the CLI and tests, later handlers avoid false reports, both modes are covered, and docs/errors.md describes the behavior.

Written by the indexing model from the issue text.

Description

bug runtime

Summary

A promise rejection that is never handled is silently ignored: GocciaRunner prints nothing and exits 0. Unhandled rejections should be reported, and should fail the run.

Why

Scripts and CI jobs rely on the exit status. A forgotten await or a missing .catch on a failing promise currently looks like success. ECMA-262 leaves rejection tracking to the host (HostPromiseRejectionTracker). Node.js and Deno both report an unhandled rejection with its error and exit non-zero by default. The docs don't describe GocciaScript's behavior either way.

Current behavior

On main (72cb2050), identical in --mode=interpreted and --mode=bytecode:

Promise.reject(new Error("unhandled"));
console.log("end of script");

This prints end of script and exits 0 with nothing on stderr. By contrast, an awaited rejection at top level (await Promise.reject(...)) is reported as an uncaught error.

Expected behavior

  • When a rejected promise has no handler by the time the job queue drains (the usual HostPromiseRejectionTracker "reject" without a later "handle" rule), the CLI prints the rejection reason with the same formatting and code frame as an uncaught throw, and exits 1.
  • A handler attached later, before the queue drains, cancels the report.
  • GocciaTestRunner reports an unhandled rejection inside a test as a failure of that test or file.
  • Behavior is documented in docs/errors.md.

Scope notes

  • Decide whether embedders get a hook or setting rather than a hard-coded exit (the CLI default should fail).
  • Check sandbox mode and runScript children; the child's result should expose the failure. This interacts with #1293, since jobs currently cross engine boundaries.
  • Add tests in both modes.
  • Found while re-validating #1293.
Dominant language
Pascal
Stars
20
Forks
4
Avg merge
20h 57m
Merged PRs (30d)
131

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from frostney/GocciaScript

All issues in frostney/GocciaScript

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.