{"record":{"id":"467856737ef2ca64","repo":"vercel/next.js","slug":"failed-to-parse-src-src-on-next-image-prot","errorCode":null,"errorMessage":"Failed to parse src \"${src}\" on `next/image`, protocol-relative URL (//) must be changed to an absolute URL (http:// or https://)","messagePattern":"Failed to parse src \"(.+?)\" on `next/image`, protocol-relative URL \\(//\\) must be changed to an absolute URL \\(http:// or https://\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/shared/lib/image-loader.ts","lineNumber":69,"sourceCode":"    }\n  }\n\n  if (\n    src.startsWith('/') &&\n    src.includes('?') &&\n    config.localPatterns?.length === 1 &&\n    config.localPatterns[0].pathname === '**' &&\n    config.localPatterns[0].search === ''\n  ) {\n    throw new Error(\n      `Image with src \"${src}\" is using a query string which is not configured in images.localPatterns.` +\n        `\\nRead more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`\n    )\n  }\n\n  if (process.env.NODE_ENV !== 'production') {\n    if (src.startsWith('//')) {\n      throw new Error(\n        `Failed to parse src \"${src}\" on \\`next/image\\`, protocol-relative URL (//) must be changed to an absolute URL (http:// or https://)`\n      )\n    }\n\n    if (src.startsWith('/') && config.localPatterns) {\n      if (\n        process.env.NODE_ENV !== 'test' &&\n        // micromatch isn't compatible with edge runtime\n        process.env.NEXT_RUNTIME !== 'edge'\n      ) {\n        // We use dynamic require because this should only error in development\n        const { hasLocalMatch } =\n          require('./match-local-pattern') as typeof import('./match-local-pattern')\n        if (!hasLocalMatch(config.localPatterns, src)) {\n          throw new Error(\n            `Invalid src prop (${src}) on \\`next/image\\` does not match \\`images.localPatterns\\` configured in your \\`next.config.js\\`\\n` +\n              `See more info: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`\n          )","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/shared/lib/image-loader.ts#L51-L87","documentation":"Dev-only props validation in defaultLoader: the src starts with //, a protocol-relative URL. The image loader cannot safely guess http vs https, and such URLs break when served from file:// or non-HTTP contexts, so in development the ambiguity is rejected and an absolute scheme is demanded.","triggerScenarios":"next/image src is a protocol-relative URL.","commonSituations":"Using '//example.com/img.png' as src instead of an absolute http(s) URL.","solutions":["Change the protocol-relative //src to an absolute http(s) URL."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0eb377541648e63402a47b38fee00a8d0ce8f8f1","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}