`glob()` loader seems to swallow Markdown rendering errors and lets astro build exit successfully
Astro Info
Astro v7.2.9
Vite v8.2.2
Node v24.19.0
System Linux (x64)
Package Manager npm
Output static
Adapter none
Integrations noneIf this issue only occurs in one browser, which browser is a problem?
Not browser-specific; this occurs during astro build.
Describe the Bug
When a Markdown plugin throws during the glob() loader's eager rendering, Astro logs the error but continues building and exits with code 0. This lets CI treat incomplete output as a successful build.
I encountered this while validating image references. The reduced reproduction uses @astrojs/[email protected] and [email protected] with a plugin that deliberately throws on any image:
defineMdastPlugin({
name: "missing-image-repro",
image(node) {
throw new Error("Cannot resolve image: " + node.url);
},
})The collection uses glob({ pattern: "**/*.md", base: "./src/content" }). A note contains , and the index page retrieves that entry and renders .
- Install dependencies with npm install.
- Run astro build --force.
- Observe the rendering error followed by a successful build and exit code 0.
[ERROR] [glob-loader] Error rendering test.md: Cannot resolve image: /missing.png
[content] Synced content
...
[build] 1 page(s) built
[build] Complete!Verified results:
- Note without an image: exit 0.
- Note triggering the plugin error, default glob() options: exit 0.
- Same failing note with deferRender: true: exit 1.
What's the expected result?
A Markdown rendering error should make astro build exit with a nonzero status, so CI can prevent deployment of incomplete output. Whether rendering is eager or deferred should not determine whether the build reports failure.
Link to Minimal Reproducible Example
https://github.com/OlaoluwaM/digitalgarden-blog/tree/astro-rewrite
Participation
- I am willing to submit a pull request for this issue.
Source: withastro/astro