{"record":{"id":"f02440a212198076","repo":"withastro/astro","slug":"invalidgetstaticpathsentry","errorCode":"InvalidGetStaticPathsEntry","errorMessage":"Invalid entry returned by `getStaticPaths()`. Expected an object, got `${entryType}`.","messagePattern":"Invalid entry returned by `getStaticPaths\\(\\)`\\. Expected an object, got `(.+?)`\\.","errorType":"exception","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/core/routing/validation.ts","lineNumber":39,"sourceCode":"\t\t});\n\t}\n}\n\n/** Throw error and log warnings for malformed getStaticPaths() response */\nexport function validateGetStaticPathsResult(result: GetStaticPathsResult, route: RouteData) {\n\tif (!Array.isArray(result)) {\n\t\tthrow new AstroError({\n\t\t\t...AstroErrorData.InvalidGetStaticPathsReturn,\n\t\t\tmessage: AstroErrorData.InvalidGetStaticPathsReturn.message(typeof result),\n\t\t\tlocation: {\n\t\t\t\tfile: route.component,\n\t\t\t},\n\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});","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/core/routing/validation.ts#L21-L57","documentation":"Each element of the getStaticPaths() array must be a plain object (an entry with params). validateGetStaticPathsResult throws AstroError code InvalidGetStaticPathsEntry when an entry is itself an array (nested array) or null. The reported type is 'array' for nested arrays, otherwise typeof the entry.","triggerScenarios":"Returning an array-of-arrays such as [[{params}], [{params}]] — typical when a .map inside .map is not flattened; including a null entry in the returned array.","commonSituations":"Using nested .map calls that produce arrays of arrays; Promise.all returning arrays of arrays; filtering that leaves nulls.","solutions":["Flatten nested results with .flat() or switch the inner .map to .flatMap().","Remove any null/undefined entries before returning.","Confirm each element is a plain object literal { params, props? }."],"exampleFix":"// before\nexport async function getStaticPaths() {\n  return ids.map((id) => sub.map((s) => ({ params: { id, s } })));\n}\n// after\nexport async function getStaticPaths() {\n  return ids.flatMap((id) => sub.map((s) => ({ params: { id, s } })));\n}","handlingStrategy":"type-guard","validationCode":"function normalizeGSP(entries) {\n  const flat = entries.flat();\n  for (const e of flat) {\n    if (e === null || Array.isArray(e) || typeof e !== 'object') {\n      throw new TypeError(`Invalid getStaticPaths entry: ${Array.isArray(e) ? 'array' : typeof e}`);\n    }\n  }\n  return flat;\n}","typeGuard":"const isGSPEntry = (e: unknown): e is { params: Record<string, unknown> } =>\n  e !== null && typeof e === 'object' && !Array.isArray(e);","tryCatchPattern":null,"preventionTips":["Prefer .flatMap over nested .map to avoid arrays-of-arrays.","Filter out null/undefined before returning.","Type getStaticPaths' return as an array of entry objects."],"tags":["getstaticpaths","routing","build"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}