withastro/astro · warning

No pages found! `${outFile}` not created.

Error message

No pages found!
`${outFile}` not created.

What it means

After the Sitemap integration collects pageUrls from built pages, resolved routes, and customPages, applies the filter option, and dedupes, it checks for an empty list. If zero URLs remain, it warns 'No pages found!' together with the would-be output filename and returns without writing any sitemap file. The build still exits successfully.

Source

Thrown at packages/integrations/sitemap/src/index.ts:177

						addRouteUrl(urls, r);

						// Include i18n fallback routes (e.g. /fr/ falling back to /en/)
						for (const fallbackRoute of r.fallbackRoutes ?? []) {
							addRouteUrl(urls, fallbackRoute);
						}

						return urls;
					}, []);

					pageUrls = Array.from(new Set([...pageUrls, ...routeUrls, ...(customPages ?? [])]));

					if (filter) {
						pageUrls = pageUrls.filter((value) => filter(value));
					}

					if (pageUrls.length === 0) {
						logger.warn(`No pages found!\n\`${outFile}\` not created.`);
						return;
					}

					let urlData = generateSitemap(pageUrls, finalSiteUrl.href, opts);

					if (serialize) {
						try {
							const serializedUrls: SitemapItem[] = [];
							for (const item of urlData) {
								const serialized = await Promise.resolve(serialize(item));
								if (serialized) {
									serializedUrls.push(serialized);
								}
							}
							if (serializedUrls.length === 0) {
								logger.warn('No pages found!');
								return;
							}

View on GitHub (pinned to 157c500c38)

Solutions

  1. Loosen or fix the filter option so at least one URL passes, e.g. filter: (page) => page !== 'https://example.com/secret'.
  2. Add customPages: ['https://example.com/'] so at least the homepage is listed.
  3. Print the URL list before filtering (log getStaticPaths output or config.integrations debug) to see what the filter is removing.
  4. Confirm dist/ contains sitemap-index.xml after rebuilding; if you truly want no sitemap, remove the integration to silence the warning.

Example fix

// before
sitemap({
  filter: (page) => page.includes('/blog/'), // site has no /blog routes -> zero URLs
}),

// after
sitemap({
  filter: (page) => !page.includes('/admin'),
  customPages: ['https://www.example.com/'],
}),
Defensive patterns

Strategy: validation

Validate before calling

const sampleUrls = ['https://www.example.com/', 'https://www.example.com/blog/'];
const kept = typeof filter === 'function' ? sampleUrls.filter(filter) : sampleUrls;
if (kept.length === 0) {
  throw new Error('sitemap filter excludes every candidate URL; refusing to emit empty sitemap');
}

Prevention

When it happens

Trigger: filter callback excludes every URL (e.g. filter: (url) => url.includes('/docs') on a site with no /docs routes); a build where all routes are non-page (API endpoints, redirects, 404) and customPages is unset; i18n/lastmod configurations that reduce the set to zero.

Common situations: A filter glob/match copied from another project that matches nothing here; sites whose content is all client-rendered or served from a single route; excluding pruned routes and accidentally excluding everything.

Related errors


AI-assisted analysis of withastro/astro@157c500c38 (2026-08-18). Data as JSON: /api/errors/2092dc93472d57b8. Report an issue: GitHub.