From ed1dbc9e50b113a3d9f9d1d09610eccc7499ea9d Mon Sep 17 00:00:00 2001 From: Nathan Arthur Date: Wed, 13 May 2026 17:00:18 -0400 Subject: [PATCH] Quiet expected ENOENT in image-cache script readdirSync on the astro image cache folder throws ENOENT on a clean checkout before astro has populated it. That's the normal first-build case, so log a one-liner and move on instead of dumping the full Error object. Other errors still warn loudly. Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/image-cache.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/image-cache.mjs b/scripts/image-cache.mjs index 10d7e704..054659f0 100644 --- a/scripts/image-cache.mjs +++ b/scripts/image-cache.mjs @@ -12,7 +12,13 @@ let files = []; try { files = readdirSync(folderPath, "utf8"); } catch (e) { - console.warn(e); + if (e.code === "ENOENT") { + // First build on a clean checkout — astro hasn't populated its image + // cache yet, so there's nothing to extend. Quiet, expected case. + console.log(`image-cache: no astro cache yet at ${folderPath}, skipping`); + } else { + console.warn(`image-cache: failed to read ${folderPath}:`, e); + } } for (const file of files.filter((f) => f.endsWith(".json"))) {