withastro/astro · warning

No contents found for ${entry}

Error message

No contents found for ${entry}

What it means

fs.readFile failed for a file the glob loader matched; the underlying OS error was already logged as 'Error reading <entry>'. Because the .catch returns undefined, this second warning fires when contents is undefined (the file could not be read at all), as opposed to a legitimately empty file, which passes the contents !== '' check.

Source

Thrown at packages/astro/src/content/loaders/glob.ts:142

			const untouchedEntries = new Set(store.keys());
			async function syncData(
				entry: string,
				base: URL,
				entryType?: ContentEntryType,
				oldId?: string,
			) {
				if (!entryType) {
					logger.warn(`No entry type found for ${entry}`);
					return;
				}
				const fileUrl = new URL('./' + encodeURI(entry), base);
				const contents = await fs.readFile(fileUrl, 'utf-8').catch((err) => {
					logger.error(`Error reading ${entry}: ${err.message}`);
					return;
				});

				if (!contents && contents !== '') {
					logger.warn(`No contents found for ${entry}`);
					return;
				}

				const { body, data } = await entryType.getEntryInfo({
					contents,
					fileUrl,
				});

				const id = generateId({ entry, base, data });

				if (oldId && oldId !== id) {
					store.delete(oldId);
				}

				untouchedEntries.delete(id);

				const existingEntry = store.get(id);

View on GitHub (pinned to e294953aa8)

Solutions

  1. Check the preceding 'Error reading <entry>' error line for the real OS message and fix that cause (permissions, missing file)
  2. Restart the dev server if it was a transient race during a file rename or delete
  3. Exclude the problematic path from the glob pattern if it is not content
Defensive patterns

Strategy: retry

Validate before calling

// Before a sync, confirm the matched files still exist and are readable
import { access, constants } from 'node:fs/promises';
async function assertReadable(files: string[]) {
  await Promise.all(files.map((f) => access(f, constants.R_OK)));
}

Try / catch

// Handle editor atomic-save races with bounded backoff around reads
import { readFile } from 'node:fs/promises';
async function readWithRetry(path: string, attempts = 3): Promise<string> {
  for (let i = 0; i < attempts; i++) {
    try { return await readFile(path, 'utf-8'); }
    catch (err) {
      if (i === attempts - 1) throw err;
      await new Promise((r) => setTimeout(r, 100 * 2 ** i));
    }
  }
  throw new Error('unreachable');
}

Prevention

When it happens

Trigger: A file matched by the glob is deleted, renamed, or becomes unreadable between the glob and the read (dev-server watch races); permission errors; broken symlinks; files removed by git operations mid-sync.

Common situations: Editors doing atomic saves (write temp file + rename) while `astro dev` is running; content on network/synced mounts with flaky reads; restrictive file permissions in CI runners.

Related errors


AI-assisted analysis of withastro/astro@e294953aa8 (2026-08-18). Data as JSON: /api/errors/1cfd19b7596e9eca. Report an issue: GitHub.