Skip to content

AbortSignal.timeout throws RangeError with any decimal number input #58592

Closed as not planned

Description

@cprass

Version

v24.1.0

Platform


Subsystem

No response

What steps will reproduce the bug?

The bug is easy to reproduce using the timeout function with a decimal.

AbortSignal.timeout(1.1)

How often does it reproduce? Is there a required condition?

It always produces the same error.

What is the expected behavior? Why is that the expected behavior?

I'd expect it to work with all numbers, including decimal numbers, within the range of 0 and Number.MAX_SAFE_INTEGER. Browsers and other JS runtimes all seem to allow decimals. There is no mention of this special behavior in the NodeJS docs.

What do you see instead?

Uncaught:
RangeError [ERR_OUT_OF_RANGE]: The value of "delay" is out of range. It must be an integer. Received 1.1
    at AbortSignal.timeout (node:internal/abort_controller:239:5) {
  code: 'ERR_OUT_OF_RANGE'
}

Additional information

No response

Activity

  1. Renegade334 commented on Jun 5, 2025

    @Renegade334
  2. cprass commented on Jun 6, 2025

    @cprass
    Author

    The web specification mandates that the parameter be validated as an unsigned integer.

    ref: https://dom.spec.whatwg.org/#interface-AbortSignal

    The spec defines how IDL types map to JavaScript https://webidl.spec.whatwg.org/#js-unsigned-long-long. Doesn't [EnforceRange] unsigned long long allow any JS number and coerces the value?

  3. bakkot commented on Jun 6, 2025

    @bakkot
    Contributor

    [EnforceRange] says

    The Number will be rounded toward zero before being checked against its range.

    The attribute is only about the upper and lower bounds, not about non-integer inputs. The example in that section has an input of -0.9 not throwing.

  4. BrodaNoel commented on Jun 11, 2025

    @BrodaNoel

    For some reason, I sudently have this issue as well.

  5. github-actions commented on Apr 19, 2026

    @github-actions
    Contributor

    This issue has been marked as stale due to 210 days of inactivity.
    It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

  6. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    and removed
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Apr 19, 2026
  7. github-actions commented on Jul 20, 2026

    @github-actions
    Contributor

    This issue has been marked as stale due to 90 days of inactivity.
    It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

  8. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Jul 20, 2026
  9. github-actions commented on Aug 20, 2026

    @github-actions
    Contributor

    This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
    If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions