{"record":{"id":"21d89f97b9b06b05","repo":"withastro/astro","slug":"no-pages-found","errorCode":null,"errorMessage":"No pages found!","messagePattern":"No pages found!","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/integrations/sitemap/src/index.ts","lineNumber":193,"sourceCode":"\n\t\t\t\t\tif (pageUrls.length === 0) {\n\t\t\t\t\t\tlogger.warn(`No pages found!\\n\\`${outFile}\\` not created.`);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tlet urlData = generateSitemap(pageUrls, finalSiteUrl.href, opts);\n\n\t\t\t\t\tif (serialize) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst serializedUrls: SitemapItem[] = [];\n\t\t\t\t\t\t\tfor (const item of urlData) {\n\t\t\t\t\t\t\t\tconst serialized = await Promise.resolve(serialize(item));\n\t\t\t\t\t\t\t\tif (serialized) {\n\t\t\t\t\t\t\t\t\tserializedUrls.push(serialized);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (serializedUrls.length === 0) {\n\t\t\t\t\t\t\t\tlogger.warn('No pages found!');\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\turlData = serializedUrls;\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\tlogger.error(`Error serializing pages\\n${(err as any).toString()}`);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst destDir = fileURLToPath(dir);\n\t\t\t\t\tconst lastmod = opts.lastmod?.toISOString();\n\t\t\t\t\tconst xslURL = opts.xslURL ? new URL(opts.xslURL, finalSiteUrl).href : undefined;\n\n\t\t\t\t\tif (chunks) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlet groupedUrlCollection: SitemapItem['url'][] = [];\n\t\t\t\t\t\t\tconst chunksItem: Record<string, SitemapItem[]> = {};\n\t\t\t\t\t\t\tfor (const [key, cb] of Object.entries(chunks)) {","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/withastro/astro/blob/157c500c38faa7ecf1251adbaeefcd109470d75c/packages/integrations/sitemap/src/index.ts#L175-L211","documentation":"When the Sitemap integration's serialize option is provided, it maps every generated SitemapItem through the user's serialize() callback and collects truthy return values. If the callback returns falsy for every item (or returns nothing), serializedUrls ends up empty, this 'No pages found!' warning prints, and the sitemap write is skipped entirely.","triggerScenarios":" Passing serialize: (item) => { ... } whose logic returns undefined for all items — e.g. a conditional that never matches, a mapping that builds an object but forgets to return it, or returning null to 'skip' every page. The serializedUrls.length === 0 branch fires.","commonSituations":" A serialize callback copied from docs where the return statement was trimmed; logic intended to exclude only some pages accidentally excluding all; early returns based on changefreq/priority fields that are missing on every item.","solutions":["Make serialize return the (possibly modified) item for pages you want kept: serialize: (item) => ({ ...item, changefreq: 'daily' }).","Return undefined only for items you intentionally want dropped, and verify at least one path returns an object.","Log item.url inside serialize once to confirm the callback runs and reaches a return statement.","Remove the serialize option temporarily to verify the sitemap generates, then re-add it incrementally."],"exampleFix":"// before\nsitemap({\n  serialize: (item) => {\n    if (item.url.includes('/docs')) { // condition matches nothing on this site\n      return { ...item, changefreq: 'weekly' };\n    }\n  },\n}),\n\n// after\nsitemap({\n  serialize: (item) => ({\n    ...item,\n    changefreq: item.url.includes('/docs') ? 'weekly' : 'monthly',\n  }),\n}),","handlingStrategy":"validation","validationCode":"const probe = { url: 'https://www.example.com/', lastmod: new Date() };\nconst result = serialize(probe);\nif (!result) {\n  throw new Error('serialize() must return an item for at least some inputs; sitemap would be empty');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Make the default branch of serialize return the spread item, and only return falsy for intentional exclusions.","Test serialize with one real SitemapItem and assert the return value is an object.","Log item.url inside serialize during development to confirm every branch returns."],"tags":["sitemap","serialize","no-pages","seo","callback"],"backgroundTag":"empty-sitemap","analyzedSha":"157c500c38faa7ecf1251adbaeefcd109470d75c","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}