#18054·astro

`glob()` loader seems to swallow Markdown rendering errors and lets astro build exit successfully

Author: OlaoluwaMCreated Sep 17, 2026Updated Sep 28, 2026
Labelspkg: astro- P4: importanttriage: fix pending

Astro Info

block
Astro                    v7.2.9
Vite                     v8.2.2
Node                     v24.19.0
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             none

If 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:

typescript
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 ![Missing image](/missing.png), and the index page retrieves that entry and renders .

  1. Install dependencies with npm install.
  2. Run astro build --force.
  3. 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!

full-log

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.