镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fetch('/') in the Repl causing infinite errors #59731

Description

@jasnell

Version

24.7.0

Platform

All

Subsystem

repl

What steps will reproduce the bug?

Open the repl, type fetch('/'). ... (the period at the end triggers it)

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

Always

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

It should print a single error because the URL is not absolute...

What do you see instead?

The repl enters a busy loop trying to parse the URL over and over

...
> Uncaught [TypeError: Failed to parse URL from /] {
  [cause]: TypeError: Invalid URL
      at new URL (node:internal/url:826:25)
      at new Request (node:internal/deps/undici/undici:10150:25)
      at fetch (node:internal/deps/undici/undici:10920:25)
      at fetch (node:internal/deps/undici/undici:15443:10)
      at fetch (node:internal/bootstrap/web/exposed-window-or-worker:83:12)
      at REPL199480:1:7
      at ContextifyScript.runInThisContext (node:vm:137:12)
      at REPLServer.defaultEval (node:repl:599:22)
      at bound (node:domain:433:15)
      at REPLServer.runBound [as eval] (node:domain:444:12) {
    code: 'ERR_INVALID_URL',
    input: '/'
  }
}
> Uncaught [TypeError: Failed to parse URL from /] {
  [cause]: TypeError: Invalid URL
      at new URL (node:internal/url:826:25)
      at new Request (node:internal/deps/undici/undici:10150:25)
      at fetch (node:internal/deps/undici/undici:10920:25)
      at fetch (node:internal/deps/undici/undici:15443:10)
      at fetch (node:internal/bootstrap/web/exposed-window-or-worker:83:12)
      at REPL199481:1:7
      at ContextifyScript.runInThisContext (node:vm:137:12)
      at REPLServer.defaultEval (node:repl:599:22)
      at bound (node:domain:433:15)
      at REPLServer.runBound [as eval] (node:domain:444:12) {
    code: 'ERR_INVALID_URL',
    input: '/'
  }
}
> Uncaught [TypeError: Failed to parse URL from /] {
  [cause]: TypeError: Invalid URL
      at new URL (node:internal/url:826:25)
      at new Request (node:internal/deps/undici/undici:10150:25)
      at fetch (node:internal/deps/undici/undici:10920:25)
      at fetch (node:internal/deps/undici/undici:15443:10)
      at fetch (node:internal/bootstrap/web/exposed-window-or-worker:83:12)
      at REPL199482:1:7
      at ContextifyScript.runInThisContext (node:vm:137:12)
      at REPLServer.defaultEval (node:repl:599:22)
      at bound (node:domain:433:15)
      at REPLServer.runBound [as eval] (node:domain:444:12) {
    code: 'ERR_INVALID_URL',
    input: '/'
  }
}
> Uncaught [TypeError: Failed to parse URL from /] {
  [cause]: TypeError: Invalid URL
      at new URL (node:internal/url:826:25)
      at new Request (node:internal/deps/undici/undici:10150:25)
      at fetch (node:internal/deps/undici/undici:10920:25)
      at fetch (node:internal/deps/undici/undici:15443:10)
      at fetch (node:internal/bootstrap/web/exposed-window-or-worker:83:12)
      at REPL199483:1:7
      at ContextifyScript.runInThisContext (node:vm:137:12)
      at REPLServer.defaultEval (node:repl:599:22)
      at bound (node:domain:433:15)
      at REPLServer.runBound [as eval] (node:domain:444:12) {
    code: 'ERR_INVALID_URL',
    input: '/'
  }
}
> zsh: killed     node

Additional information

No response

Activity

added
confirmed-bugIssues and PRs for confirmed bugs.
replIssues and PRs related to the REPL subsystem.
on Sep 2, 2025

minzunim commented on Sep 4, 2025

@minzunim

@jasnell I tried to reproduce this issue, but in my environment I only see a single error message printed.
Could you please provide additional details on how to reproduce the infinite loop?

My environment:

  • Node.js version: 24.7.0
  • OS: Windows 11
added
needs more infoIssues awaiting more information or a reproducible example from the author.
on Sep 4, 2025

targos commented on Sep 4, 2025

@targos
Member

Can't reproduce either (v24.7.0 on macOS)

removed
confirmed-bugIssues and PRs for confirmed bugs.
good first issueIssues that are suitable for first-time contributors.
on Sep 4, 2025

jasnell commented on Sep 7, 2025

@jasnell
MemberAuthor

The report is incomplete, you need to type fetch('/'). .. the period at the end is significant. I believe #59774 fixes this.

removed
needs more infoIssues awaiting more information or a reproducible example from the author.
on Sep 8, 2025
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

    replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions