sindresorhus/got · error · TypeError
The `followRedirects` option does not exist. Use `followRedi
Error message
The `followRedirects` option does not exist. Use `followRedirect` instead.
What it means
Getter for the misspelled `followRedirects` property that always throws. The correct option is the singular `followRedirect`. The trap exists so reading the wrong-named option fails loudly instead of silently returning undefined (which would make redirect behavior appear to misbehave).
Source
Thrown at source/core/options.ts:2494
Note that if a `303` is sent by the server in response to any request type (`POST`, `DELETE`, etc.), Got will automatically request the resource pointed to in the location header via `GET`.
This is in accordance with [the spec](https://tools.ietf.org/html/rfc7231#section-6.4.4). You can optionally turn on this behavior also for other redirect codes - see `methodRewriting`.
On cross-origin redirects, Got strips `host`, `cookie`, `cookie2`, `authorization`, and `proxy-authorization`. When a redirect rewrites the request to `GET`, Got also strips request body headers. Use `hooks.beforeRedirect` for app-specific sensitive headers.
@default true
*/
get followRedirect(): boolean | ((response: PlainResponse) => boolean) {
return this.#internals.followRedirect;
}
set followRedirect(value: boolean | ((response: PlainResponse) => boolean)) {
assertAny('followRedirect', [is.boolean, is.function], value);
this.#internals.followRedirect = value;
}
get followRedirects() {
throw new TypeError('The `followRedirects` option does not exist. Use `followRedirect` instead.');
}
set followRedirects(_value: unknown) {
throw new TypeError('The `followRedirects` option does not exist. Use `followRedirect` instead.');
}
/**
If exceeded, the request will be aborted and a `MaxRedirectsError` will be thrown.
@default 10
*/
get maxRedirects(): number {
return this.#internals.maxRedirects;
}
set maxRedirects(value: number) {
assert.number(value);
View on GitHub (pinned to e3924aa1e5)
Solutions
- Read `options.followRedirect` (singular) instead.
- Grep for `followRedirects` and rename to `followRedirect`.
Example fix
// before const follow = options.followRedirects; // after const follow = options.followRedirect;
Defensive patterns
Strategy: validation
Validate before calling
function assertNoFollowRedirectsRead(options) {
if ('followRedirects' in options) {
throw new TypeError('Use options.followRedirect, not followRedirects.');
}
} Prevention
- Grep for `followRedirects` and rename to the singular form.
- Rely on TypeScript types which only expose `followRedirect`.
When it happens
Trigger: Reading `options.followRedirects` anywhere, e.g. inside a hook or a custom handler that inspects redirect config.
Common situations: Pluralizing the option name (common since several libs use the plural form); reading config copied from elsewhere.
Related errors
- The `searchParameters` option does not exist. Use `searchPar
- 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/602d9857d4e2b57b.json.
Report an issue: GitHub.