{"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/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/core/routing/validation.ts#L34-L61","documentation":"Every getStaticPaths() entry must include a non-empty params object whose keys match the route's dynamic segments. validateGetStaticPathsResult throws AstroError code GetStaticPathsExpectedParams when params is undefined, null, or an object with zero keys.","triggerScenarios":"An entry like { } (no params), { params: {} }, { params: null }, or an entry where params was destructured away; a key set whose names do not match any [param] in the filename.","commonSituations":"Spreading entries and accidentally dropping params; returning { props } only; mis-typing the params key.","solutions":["Add `params: { paramName: value }` to every entry, using the exact param name from the filename.","Ensure params has at least one key and that no entry leaves params empty.","Double-check spread/rest usage that might omit params."],"exampleFix":"// before\nexport async function getStaticPaths() {\n  return [{ props: { post } }];\n}\n// after\nexport async function getStaticPaths() {\n  return [{ params: { id: post.id }, props: { post } }];\n}","handlingStrategy":"validation","validationCode":"function assertEntriesHaveParams(entries, paramNames) {\n  for (const [i, e] of entries.entries()) {\n    const keys = e.params ? Object.keys(e.params) : [];\n    if (!e.params || keys.length === 0) {\n      throw new Error(`Entry ${i} is missing a non-empty params object`);\n    }\n    for (const n of paramNames) {\n      if (!(n in e.params)) throw new Error(`Entry ${i} missing param '${n}'`);\n    }\n  }\n}","typeGuard":"const hasNonEmptyParams = (e: unknown): boolean =>\n  !!e && typeof e === 'object' &&\n  'params' in e && e.params !== null && typeof e.params === 'object' &&\n  Object.keys(e.params).length > 0;","tryCatchPattern":null,"preventionTips":["Derive required param names from the filename and assert each entry supplies them.","Avoid spreads that could omit params.","Add a small build-time test over getStaticPaths output."],"tags":["getstaticpaths","routing","build"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}