Skip to content

LIBERATED AI CHAT

TypeScript

fix: handle missing archive/legacy dir on first compaction run

faber2e1cf583434f
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')
);