Skip to content

InvalidArgumentError: invalid throwOnError #4698

@kerolloz

Description

@kerolloz

Bug Description

I get the following error

InvalidArgumentError: invalid throwOnError
    at new Request (/Users/kerollosmagdy/test-undici/node_modules/undici/lib/core/request.js:88:13)
    at [dispatch] (/Users/kerollosmagdy/test-undici/node_modules/undici/lib/dispatcher/client.js:299:21)
    at Client.dispatch (/Users/kerollosmagdy/test-undici/node_modules/undici/lib/dispatcher/dispatcher-base.js:153:29)
    at [dispatch] (/Users/kerollosmagdy/test-undici/node_modules/undici/lib/dispatcher/pool-base.js:157:28)
    at Pool.dispatch (/Users/kerollosmagdy/test-undici/node_modules/undici/lib/dispatcher/dispatcher-base.js:153:29)
    at [dispatch] (/Users/kerollosmagdy/test-undici/node_modules/undici/lib/dispatcher/agent.js:122:23)
    at Agent.dispatch (/Users/kerollosmagdy/test-undici/node_modules/undici/lib/dispatcher/dispatcher-base.js:153:29)
    at Agent.request (/Users/kerollosmagdy/test-undici/node_modules/undici/lib/api/api-request.js:202:10)
    at /Users/kerollosmagdy/test-undici/node_modules/undici/lib/api/api-request.js:193:15
    at new Promise (<anonymous>) {
  code: 'UND_ERR_INVALID_ARG'
}

Reproducible By

import {request} from 'undici'


console.log(await request('https://jsonplaceholder.typicode.com/todos/1', {
  throwOnError: true
}))

Expected Behavior

To work with no errors

Logs & Screenshots

Image

Environment

  • MacOs
  • Node.js v22.18.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions