Skip to content
Latchkey

QwikCity static build "getStaticPaths" error in CI

When the QwikCity static adapter prerenders a dynamic route, it needs the list of parameter values to generate. Exporting onStaticGenerate (the QwikCity SSG hook) supplies them; without it, dynamic pages are skipped or the build errors.

What this error means

The static build warns that a dynamic route produced no pages, or errors that params are missing, because the route has no onStaticGenerate returning the param set.

qwik
Warning: Static route /product/[id] has no onStaticGenerate export.
No static pages generated for this dynamic segment.

Common causes

A dynamic route without onStaticGenerate

The static adapter cannot know which [id] values exist, so it prerenders nothing for that route.

onStaticGenerate returns the wrong shape

Returning params in the wrong structure yields no valid pages to build.

How to fix it

Export onStaticGenerate with the params

  1. Add an onStaticGenerate export to the dynamic route returning { params: [...] }.
  2. Provide the full set of ids to prerender.
  3. Re-run the static build to confirm pages are emitted.
src/routes/product/[id]/index.tsx
export const onStaticGenerate: StaticGenerateHandler = async () => {
  const ids = await getAllProductIds();
  return { params: ids.map(id => ({ id })) };
};

Use the static adapter only for prerenderable routes

Routes that cannot be enumerated at build time should use a server adapter instead of static SSG.

How to prevent it

  • Export onStaticGenerate for every dynamic route you prerender.
  • Return { params: [...] } in the exact expected shape.
  • Use a server adapter for routes that cannot be enumerated.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →