From 2e1cf583434f622482a1da2ec3c591bb74c81017 Mon Sep 17 00:00:00 2001 From: faber Date: Tue, 14 Jul 2026 09:59:17 -0400 Subject: [PATCH] fix: handle missing archive/legacy dir on first compaction run listAllFiles('archive/legacy') throws 404 EntryNotFound when the directory doesn't exist yet on HF. Catch it so the first run proceeds instead of dying at Step 2. Co-Authored-By: Claude Opus 4.6 --- scripts/compact-hf-telemetry.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/compact-hf-telemetry.mjs b/scripts/compact-hf-telemetry.mjs index 586bec2..19de5a6 100644 --- a/scripts/compact-hf-telemetry.mjs +++ b/scripts/compact-hf-telemetry.mjs @@ -146,7 +146,12 @@ async function main() { console.log(`Step 2: Checking for existing manifest (run ID: ${currentRunId})...`); // Also check if a DIFFERENT run's manifest exists (partial deletion scenario) - const archiveLegacyEntries = await listAllFiles('archive/legacy', true); + let archiveLegacyEntries = []; + try { + archiveLegacyEntries = await listAllFiles('archive/legacy', true); + } catch (err) { + if (!/404|EntryNotFound|does not exist/i.test(String(err.message))) throw err; + } const existingManifests = archiveLegacyEntries.filter( f => f.type === 'file' && f.path.endsWith('/manifest.json') );