INVALID_IMAGE_OPTIMIZE_REQUEST
Last updated October 6, 2025
The INVALID_IMAGE_OPTIMIZE_REQUEST error occurs when the query string is using an invalid value for q (quality) or w (width), or url returns a non-image response.
400
INVALID_IMAGE_OPTIMIZE_REQUEST:
Bad Request
To troubleshoot this error, follow these steps:
- Check for typos: Verify that there are no typos in the parameter names or values
 - Review request format: Ensure that the request URL is correctly formatted and includes the required parameters
- The 
qparameter controls the quality of the image and must follow these rules:- The 
qparameter must be an integer - The 
qinteger must be greater than or equal to 1 - The 
qinteger must be less than or equal to 100 - The 
qinteger must be the same as one specified inqualities, if defined 
 - The 
 - The 
wparameter defines the width of the image and must follow these rules:- The 
wparameter must be an integer - The 
winteger must be the same as one specified indeviceSizesorimageSizesin yournext.config.js. 
 - The 
 - The 
urlparameter specifies the image location and must follow these rules:- The 
urlparameter must start with/,http://, orhttps:// - The 
urlparameter must match one of the configuredremotePatternsorlocalPatternsin yournext.config.js - The 
urlparameter must have aContent-Typeheader that starts withimage/ - The 
urlparameter must have a response body less than 300 MB (or less than 100 MB for hobby), otherwise the image won't be optimized 
 - The 
 
 - The 
 
Run next dev locally to reproduce the error and get additional details.
Was this helpful?