Skip to content

Misleading error message "URL must not be a blank string" when URL is a non-string value which does not stringify to a fully valid URL with a hostname #21361

@mitranim

Description

@mitranim

What version of Bun is running?

1.2.18+0d4089ea7

What platform is your computer?

Darwin 24.3.0 arm64 arm

What steps can reproduce the bug?

Any of the following (and more):

await fetch(undefined)
await fetch(123)
await fetch({toString() {return `/some_path`}})

What is the expected behavior?

Something more precise, like:

fetch() URL must have a hostname

What do you see instead?

fetch() URL must not be a blank string

Additional information

Link to offending line in Bun sources:

return globalObject.ERR(.INVALID_ARG_TYPE, fetch_error_blank_url, .{}).throw();

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconfirmed bugWe can reproduce this issuegood first issueSomething that would be good for new contributorsweb:fetch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions