{"record":{"id":"25ebf0f59bb4f5d6","repo":"vercel/next.js","slug":"unknown-key-passed-via-urlobject-into-url-format","errorCode":null,"errorMessage":"Unknown key passed via urlObject into url.format: ${key}","messagePattern":"Unknown key passed via urlObject into url\\.format: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/shared/lib/router/utils/format-url.ts","lineNumber":95,"sourceCode":"  'hash',\n  'host',\n  'hostname',\n  'href',\n  'path',\n  'pathname',\n  'port',\n  'protocol',\n  'query',\n  'search',\n  'slashes',\n]\n\nexport function formatWithValidation(url: UrlObject): string {\n  if (process.env.NODE_ENV === 'development') {\n    if (url !== null && typeof url === 'object') {\n      Object.keys(url).forEach((key) => {\n        if (!urlObjectKeys.includes(key)) {\n          console.warn(\n            `Unknown key passed via urlObject into url.format: ${key}`\n          )\n        }\n      })\n    }\n  }\n\n  return formatUrl(url)\n}\n","sourceCodeStart":77,"sourceCodeEnd":105,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/shared/lib/router/utils/format-url.ts#L77-L105","documentation":"formatWithValidation (dev only) iterates the keys of a UrlObject passed to url.format and warns when a key is outside the known urlObjectKeys allowlist (auth, hash, host, hostname, href, path, pathname, port, protocol, query, search, slashes) — almost always a typo; formatting still proceeds.","triggerScenarios":"Thrown at packages/next/src/shared/lib/router/utils/format-url.ts:95 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the unknown key from the URL object; only standard url.format keys are allowed."],"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"}