{"record":{"id":"32ad0266508e9da0","repo":"vercel/next.js","slug":"metadatabase-is-not-a-valid-url-metadatabase","errorCode":null,"errorMessage":"metadataBase is not a valid URL: ${metadataBase}","messagePattern":"metadataBase is not a valid URL: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/lib/metadata/metadata-resolution-primitives.ts","lineNumber":155,"sourceCode":"    return input.map((item) =>\n      convertUrlsToStrings(item)\n    ) as WithStringifiedURLs<T>\n  } else if (input && typeof input === 'object') {\n    const result: Record<string, unknown> = {}\n    for (const [key, value] of Object.entries(input)) {\n      result[key] = convertUrlsToStrings(value)\n    }\n    return result as WithStringifiedURLs<T>\n  }\n  return input as WithStringifiedURLs<T>\n}\n\nfunction normalizeMetadataBase(metadataBase: string | URL | null): URL | null {\n  if (typeof metadataBase === 'string') {\n    try {\n      metadataBase = new URL(metadataBase)\n    } catch {\n      throw new Error(`metadataBase is not a valid URL: ${metadataBase}`)\n    }\n  }\n  return metadataBase\n}\n\nasync function mergeStaticMetadata(\n  metadataBase: MetadataBaseURL,\n  source: Metadata | null,\n  target: ResolvedMetadata,\n  staticFilesMetadata: StaticMetadata,\n  metadataContext: MetadataContext,\n  titleTemplates: TitleTemplates,\n  leafSegmentStaticIcons: StaticIcons,\n  pathname: Promise<string>\n): Promise<ResolvedMetadata> {\n  if (!staticFilesMetadata) return target\n  const { icon, apple, openGraph, twitter, manifest } = staticFilesMetadata\n","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/vercel/next.js/blob/996f957c060aa17957a166216c69565c72996f4a/packages/next/src/lib/metadata/metadata-resolution-primitives.ts#L137-L173","documentation":"Metadata validation in normalizeMetadataBase: the user-supplied metadataBase value is a string that the URL constructor cannot parse, so relative metadata URLs (canonical, openGraph, twitter images) cannot be resolved against it. The offending input is the metadataBase field of the route's metadata export.","triggerScenarios":"metadata.metadataBase is set to a value that is not a valid URL.","commonSituations":"A typo or missing protocol in metadataBase in layout metadata or next.config.","solutions":["Set metadataBase to a valid absolute URL (e.g. new URL('https://example.com'))."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"996f957c060aa17957a166216c69565c72996f4a","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}