withastro/astro · warning
${issue.path.join('.')} ${issue.message + '.'}
Error message
${issue.path.join('.')} ${issue.message + '.'} What it means
At build time the @astrojs/sitemap integration feeds every URL entry (page URLs plus whatever your `serialize`/`chunks` callbacks return) into the `sitemap` package, which validates each item with Zod. When an item fails validation, the ZodError is caught here and each issue is logged as ` path message` lines instead of throwing. The affected sitemap file is skipped and the build continues — so a silent typo means your sitemap quietly never ships.
Source
Thrown at packages/integrations/sitemap/src/index.ts:269
return;
}
}
await writeSitemap({
filenameBase: filenameBase,
hostname: finalSiteUrl.href,
destinationDir: destDir,
publicBasePath: config.base,
sourceData: urlData,
limit: entryLimit,
customSitemaps,
xslURL: xslURL,
lastmod,
namespaces: opts.namespaces,
});
logger.info(`\`${outFile}\` created at \`${path.relative(process.cwd(), destDir)}\``);
} catch (err) {
if (err instanceof ZodError) {
logger.warn(formatConfigErrorMessage(err));
} else {
throw err;
}
}
},
},
};
};
export default createPlugin;
View on GitHub (pinned to 157c500c38)
Solutions
- Read the logged issue path (e.g., `changefreq`) — it names the exact field and expected shape
- Fix the serialize/chunks callback to return valid SitemapItem values
- Add a unit test over your serialize output validating changefreq/priority/lastmod before builds
- Rebuild and confirm the `sitemap-index.xml created at` info line reappears
Example fix
// before: invalid changefreq and priority -> sitemap skipped
serialize: (item) => ({ ...item, changefreq: 'sometimes', priority: 1.5 })
// after: valid values
serialize: (item) => ({ ...item, changefreq: 'weekly', priority: 0.8 }) Defensive patterns
Strategy: validation
Validate before calling
// Validate serialize/chunks output before it ever reaches the sitemap writer
const CHANGEFREQ = new Set(['always','hourly','daily','weekly','monthly','yearly','never']);
function assertValidItems(items) {
for (const it of items) {
if (it.changefreq && !CHANGEFREQ.has(it.changefreq)) throw new Error(`bad changefreq: ${it.changefreq}`);
if (it.priority != null && !(it.priority >= 0 && it.priority <= 1)) throw new Error(`bad priority: ${it.priority}`);
new URL(it.url); // throws on malformed urls
}
} Type guard
const CHANGEFREQ = new Set(['always','hourly','daily','weekly','monthly','yearly','never']);
const isSitemapItem = (i: unknown): i is { url: string; changefreq?: string; priority?: number } => {
const it = i as any;
return typeof it?.url === 'string'
&& (!it.changefreq || CHANGEFREQ.has(it.changefreq))
&& (it.priority === undefined || (typeof it.priority === 'number' && it.priority >= 0 && it.priority <= 1));
}; Prevention
- Type serialize return values as SitemapItem so the compiler catches bad literals
- Unit-test your serialize function against the changefreq/priority enums
- After each build, assert dist/sitemap-index.xml exists — validation failures skip the file silently
When it happens
Trigger: A `serialize` callback returning `changefreq: 'sometimes'` (must be always/hourly/daily/weekly/monthly/yearly/never), `priority` outside 0–1 or as a string, a malformed `lastmod`, or an invalid `url` on any item.
Common situations: Copy-pasted serialize functions from blog posts; chunks callbacks mutating items; upgrading the sitemap package to a version with stricter item validation.
Related errors
- Parameter name must match /^[a-zA-Z0-9_$]+$/
- **${String(rootRelativePath)}** contains invalid content: -
- BAD_REQUEST
- The Sitemap integration requires the `site` astro.config opt
- No pages found! `${outFile}` not created.
AI-assisted analysis of withastro/astro@157c500c38 (2026-08-18).
Data as JSON: /api/errors/b805da02135f515c.
Report an issue: GitHub.