{"record":{"id":"ce91d7502e6bb055","repo":"withastro/astro","slug":"getstaticpathsexpectedparams","errorCode":"GetStaticPathsExpectedParams","errorMessage":"Missing or empty required `params` property on `getStaticPaths()` route.","messagePattern":"Missing or empty required `params` property on `getStaticPaths\\(\\)` route\\.","errorType":"exception","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/core/routing/validation.ts","lineNumber":52,"sourceCode":"\t\t});\n\t}\n\n\tresult.forEach((pathObject) => {\n\t\tif ((typeof pathObject === 'object' && Array.isArray(pathObject)) || pathObject === null) {\n\t\t\tthrow new AstroError({\n\t\t\t\t...AstroErrorData.InvalidGetStaticPathsEntry,\n\t\t\t\tmessage: AstroErrorData.InvalidGetStaticPathsEntry.message(\n\t\t\t\t\tArray.isArray(pathObject) ? 'array' : typeof pathObject,\n\t\t\t\t),\n\t\t\t});\n\t\t}\n\n\t\tif (\n\t\t\tpathObject.params === undefined ||\n\t\t\tpathObject.params === null ||\n\t\t\t(pathObject.params && Object.keys(pathObject.params).length === 0)\n\t\t) {\n\t\t\tthrow new AstroError({\n\t\t\t\t...AstroErrorData.GetStaticPathsExpectedParams,\n\t\t\t\tlocation: {\n\t\t\t\t\tfile: route.component,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t});\n}\n","sourceCodeStart":34,"sourceCodeEnd":61,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/astro/src/core/routing/validation.ts#L34-L61","documentation":"Each getStaticPaths() entry must carry a non-empty params object — it is what Astro feeds into route pattern generation. validateGetStaticPathsResult throws GetStaticPathsExpectedParams when an entry's params is undefined, null, or an object with zero keys. An entry without params cannot produce any URL, and an empty params object on a dynamic route would emit a broken path.","triggerScenarios":"Returning [{ props: { post } }] and forgetting params; destructuring params from the wrong variable so it is undefined ({ params: post.params } where post.params does not exist); returning entries like { params: {} }; a typo such as { param: { slug } } (singular).","commonSituations":"Entries built from props-only data; content collections where the developer passes props but assumes Astro infers params; copy-paste of an entry template with params deleted; keys computed dynamically that end up empty for some items.","solutions":["Add a params object with a value for every dynamic segment in the filename: { params: { slug }, props: { post } }.","Check for typos: the key must be exactly params (plural), and its keys must match the [param] names in the route file.","Filter out items whose param value is missing before returning: items.filter(i => i.slug).map(...)."],"exampleFix":"// before\nexport async function getStaticPaths() {\n  const posts = await getCollection('blog');\n  return posts.map((post) => ({ props: { post } })); // no params\n}\n\n// after\nexport async function getStaticPaths() {\n  const posts = await getCollection('blog');\n  return posts.map((post) => ({ params: { slug: post.slug }, props: { post } }));\n}","handlingStrategy":"type-guard","validationCode":"const entries = items.map((i) => ({ params: { slug: i.slug }, props: { i } }));\nconst valid = entries.every((e) => e.params && Object.keys(e.params).length > 0);\nif (!valid) throw new Error('every getStaticPaths entry needs non-empty params');\nreturn entries;","typeGuard":"function hasParams(\n  e: unknown,\n): e is { params: Record<string, string | undefined> } {\n  return (\n    typeof e === 'object' &&\n    e !== null &&\n    'params' in e &&\n    typeof (e as { params: unknown }).params === 'object' &&\n    (e as { params: object }).params !== null &&\n    Object.keys((e as { params: object }).params).length > 0\n  );\n}","tryCatchPattern":null,"preventionTips":["params keys must exactly match the [names] in the filename; params must be non-empty.","Filter out items with missing slugs before mapping them into entries.","Copy the { params, props } entry shape verbatim; do not rename params."],"tags":["astro","getstaticpaths","static-generation","params","validation"],"backgroundTag":"getstaticpaths-validation-failed","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}