apify/crawlee · error · Error
Request with GET method cannot have a payload.
Error message
Request with GET method cannot have a payload.
What it means
A GET request cannot carry a payload/body, so the Request constructor rejects the combination of method GET (explicit or the default) with a non-empty payload. HTTP semantics simply do not define a body for GET.
Source
Thrown at packages/core/src/request.ts:217
keepUrlFragment = false,
useExtendedUniqueKey = false,
alwaysEnqueue = false,
skipNavigation,
enqueueStrategy,
crawlDepth,
} = options as RequestOptions & {
loadedUrl?: string;
retryCount?: number;
sessionId?: string;
errorMessages?: string[];
handledAt?: string | Date;
};
let { method = 'GET' } = options;
method = method.toUpperCase() as AllowedHttpMethods;
if (method === 'GET' && payload) throw new Error('Request with GET method cannot have a payload.');
if (uniqueKey && alwaysEnqueue) {
throw new Error('`alwaysEnqueue` cannot be used together with a custom `uniqueKey`.');
}
this.id = id;
this.url = url;
this.loadedUrl = loadedUrl;
this.uniqueKey =
uniqueKey ||
CrawleeRequest.computeUniqueKey({
url,
method,
payload,
keepUrlFragment,
useExtendedUniqueKey,
alwaysEnqueue,
});View on GitHub (pinned to dbe57fb09c)
Solutions
- Change the method to POST (or PUT/PATCH) when sending a payload
- Move the data into the URL query string if GET is required
- Assert/validate that payload is undefined whenever method is GET
Example fix
// before
const request = new Request({ url: 'https://example.com/search', payload: { q: 'x' } });
// after
const request = new Request({ url: 'https://example.com/search', method: 'POST', payload: { q: 'x' } }); Defensive patterns
Strategy: validation
Validate before calling
if ((method?.toUpperCase() ?? 'GET') === 'GET' && payload) throw new Error('GET cannot have a payload'); Try / catch
try {
return new Request(opts);
} catch (err) {
if (err.message.includes('GET method cannot have a payload')) {
return new Request({ ...opts, method: 'POST' });
}
throw err;
} Prevention
- Remember method defaults to GET — set it explicitly when sending a body
- Validate method/payload pairing in request-building helpers
- Use query params for GET data instead of a body
When it happens
Trigger: new Request({ url, payload, method: 'GET' }) or new Request({ url, payload }) omitting method (defaults to GET).
Common situations: Sending data via GET that should be a POST; forgetting that method defaults to GET when only payload is provided; building requests dynamically where method and payload drift out of sync.
Related errors
- `alwaysEnqueue` cannot be used together with a custom `uniqu
- RequestValidationError(label, result.issues)
- At most one of `body`, `form` and `json` may be specified in
- Failed to infer format from the path: '${path}'. Supported f
- Unsupported format: '${format}'. Use one of ${supportedForma
AI-assisted analysis of apify/crawlee@dbe57fb09c (2026-08-30).
Data as JSON: /api/errors/d97176ed986b7ca6.
Report an issue: GitHub.