Skip to content

H2CClient silently ignores invalid concurrency options instead of surfacing configuration errors #5142

@trivikr

Description

@trivikr

Bug Description

H2CClient silently ignores invalid concurrency options instead of surfacing configuration errors.

Reproducible By

import { Client, H2CClient } from "undici";

try {
  new Client("http://localhost", { maxConcurrentStreams: 0 });
} catch (err) {
  console.log("Client throws:", err.constructor.name, err.message);
}

const h2c = new H2CClient("http://localhost", {
  maxConcurrentStreams: 0,
  pipelining: 0,
});

console.log("H2CClient pipelining:", h2c.pipelining);
h2c.close();

Expected Behavior

H2CClient should not silently replace invalid user-provided concurrency options with defaults.

Expected behavior should be consistent with Client validation, especially for maxConcurrentStreams:

new H2CClient('http://localhost', { maxConcurrentStreams: 0 })
// should throw InvalidArgumentError

For pipelining, H2CClient should either reject invalid values explicitly or otherwise preserve the same semantics as Client instead of converting provided values such as 0 to the default 100.

Logs & Screenshots

Client throws: InvalidArgumentError maxConcurrentStreams must be a positive integer, greater than 0
H2CClient pipelining: 100

Environment

macOS 26.4.1
Node v24.15.0
undici v8.1.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions