{"record":{"id":"25f1d4814c71ff10","repo":"vercel/next.js","slug":"specified-images-domains-should-be-an-array-receiv","errorCode":null,"errorMessage":"Specified images.domains should be an Array received ${typeof images.domains}.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config","messagePattern":"Specified images\\.domains should be an Array received (.+?)\\.\nSee more info here: https://nextjs\\.org/docs/messages/invalid-images-config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/server/config.ts","lineNumber":752,"sourceCode":"          // avoid double-pushing the same pattern if it already can be matched\n          if (!hasMatchForAssetPrefix) {\n            images.remotePatterns.push({\n              hostname: url.hostname,\n              protocol: url.protocol.replace(/:$/, '') as 'http' | 'https',\n              port: url.port,\n            })\n          }\n        } catch (error) {\n          throw new Error(\n            `Invalid assetPrefix provided. Original error: ${error}`\n          )\n        }\n      }\n    }\n\n    if (images.domains) {\n      if (!Array.isArray(images.domains)) {\n        throw new Error(\n          `Specified images.domains should be an Array received ${typeof images.domains}.\\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`\n        )\n      }\n    }\n\n    if (!images.loader) {\n      images.loader = 'default'\n    }\n\n    if (\n      images.loader !== 'default' &&\n      images.loader !== 'custom' &&\n      images.path === imageConfigDefault.path\n    ) {\n      throw new Error(\n        `Specified images.loader property (${images.loader}) also requires images.path property to be assigned to a URL prefix.\\nSee more info here: https://nextjs.org/docs/api-reference/next/legacy/image#loader-configuration`\n      )\n    }","sourceCodeStart":734,"sourceCodeEnd":770,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/server/config.ts#L734-L770","documentation":"`images.domains` (the legacy allow-list of remote hostnames as strings) must be an array if provided. The check at config.ts:750-756 rejects truthy non-arrays because the optimizer iterates the list. An unset value is allowed (no domains); only a wrong type throws.","triggerScenarios":"Setting `images: { domains: 'cdn.example.com' }` (string) or `domains: { host: 'cdn.example.com' }` (object).","commonSituations":"Confusing `domains` (array of plain hostname strings) with `remotePatterns` (array of objects). Supplying a single hostname string from a quick example.","solutions":["Use an array of strings: `domains: ['cdn.example.com', 'img.example.com']`.","Prefer the newer `remotePatterns` for richer matching; `domains` is deprecated for new projects.","Remove the key if no remote domains are needed."],"exampleFix":"// before\nmodule.exports = { images: { domains: 'cdn.example.com' } }\n// after\nmodule.exports = { images: { domains: ['cdn.example.com'] } }","handlingStrategy":"type-guard","validationCode":"const d = config.images?.domains;\nif (d != null && !Array.isArray(d)) throw new Error('images.domains must be an array of strings');\nif (Array.isArray(d) && d.some((x) => typeof x !== 'string')) throw new Error('each domain must be a string');","typeGuard":"function isDomainsArray(v: unknown): v is string[] {\n  return Array.isArray(v) && v.every((x) => typeof x === 'string');\n}","tryCatchPattern":null,"preventionTips":["Remember domains is string[]; remotePatterns is object[].","Prefer remotePatterns for new projects."],"tags":["config","images","domains","next-config"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}