Back to Withastro

Invalid entry inside getStaticPath's return value

src/content/docs/en/reference/errors/invalid-get-static-paths-entry.mdx

latest880 B
Original Source

import DontEditWarning from '~/components/DontEditWarning.astro'

<DontEditWarning />

InvalidGetStaticPathsEntry: Invalid entry returned by getStaticPaths. Expected an object, got ENTRY_TYPE

What went wrong?

getStaticPaths's return value must be an array of objects. In most cases, this error happens because an array of array was returned. Using .flatMap() or a .flat() call may be useful.

ts
export async function getStaticPaths() {
	return [ // <-- Array
		{ params: { slug: "blog" } }, // <-- Object
		{ params: { slug: "about" } }
	];
}

See Also: