sindresorhus/got · error · Error
The `searchParameters` option does not exist. Use `searchPar
Error message
The `searchParameters` option does not exist. Use `searchParams` instead.
What it means
Getter for the misspelled `searchParameters` property that always throws. Got only supports `searchParams`; the trap getter exists to give a clear, actionable message the moment a user reads the wrong-named property instead of returning `undefined` and hiding the bug.
Source
Thrown at source/core/options.ts:2328
if (this.#merging) {
// These keys will be replaced
for (const key of updated.keys()) {
searchParameters.delete(key);
}
for (const [key, value] of updated) {
searchParameters.append(key, value);
}
} else if (url) {
// Overrides the query string in the URL.
url.search = updated.toString();
} else {
this.#internals.searchParams = updated;
}
}
get searchParameters() {
throw new Error('The `searchParameters` option does not exist. Use `searchParams` instead.');
}
set searchParameters(_value: unknown) {
throw new Error('The `searchParameters` option does not exist. Use `searchParams` instead.');
}
get dnsLookup(): LookupFunction | undefined {
return this.#internals.dnsLookup;
}
set dnsLookup(value: LookupFunction | undefined) {
assertAny('dnsLookup', [is.function, is.undefined], value);
this.#internals.dnsLookup = value;
}
/**
A DNS cache instance used for making DNS lookups.View on GitHub (pinned to e3924aa1e5)
Solutions
- Read `options.searchParams` instead of `options.searchParameters`.
- Search your codebase for `searchParameters` and rename all references.
Example fix
// before const params = options.searchParameters; // after const params = options.searchParams;
Defensive patterns
Strategy: validation
Validate before calling
function assertNoSearchParametersRead(options) {
if ('searchParameters' in options) {
throw new TypeError('Use options.searchParams, not searchParameters.');
}
} Prevention
- Grep the codebase for `searchParameters` and remove every reference.
- Rely on the TypeScript types which only expose `searchParams`.
When it happens
Trigger: Accessing `options.searchParameters` (read) on an Options instance, e.g. inside a hook doing `options.searchParameters`, or any code path that reads the misspelled key.
Common situations: Confusing the name with `URLSearchParams`; porting code that used a `searchParameters` key from another lib; typos.
Related errors
- The `followRedirects` option does not exist. Use `followRedi
- Unexpected option: ${key}
- Unexpected hook event: ${knownHookEvent}
- Unexpected retry option: ${key}
- Parameter `auth` is deprecated. Use `username` / `password`
AI-assisted analysis of sindresorhus/got@e3924aa1e5 (2026-08-03).
Data as JSON: /data/errors/2295752a117c968c.json.
Report an issue: GitHub.