jackwener/OpenCLI · warning · EmptyResultError
No Wayback snapshot for "${target}".
Error message
No Wayback snapshot for "${target}". What it means
An EmptyResultError thrown when the Wayback save API response contains no archived snapshot (or the closest snapshot is marked unavailable). This is an expected outcome, not a fault: it tells the user that no archived copy of the target exists or was just created. The second argument is a human-facing hint including the requested URL.
Source
Thrown at clis/archive/wayback.js:69
'User-Agent': 'opencli/1.0 (+https://github.com/jackwener/opencli)',
},
});
} catch (error) {
throw new CommandExecutionError(`archive wayback request failed: ${error?.message || error}`);
}
if (!resp.ok) {
throw new CommandExecutionError(`archive wayback failed: HTTP ${resp.status}`);
}
let data;
try {
data = await resp.json();
} catch (error) {
throw new CommandExecutionError(`archive wayback returned malformed JSON: ${error?.message || error}`);
}
const snap = data?.archived_snapshots?.closest;
if (!snap || !snap.available) {
throw new EmptyResultError('archive wayback', `No Wayback snapshot for "${target}".`);
}
if (typeof snap.url !== 'string' || !snap.url || !/^\d{14}$/.test(String(snap.timestamp ?? ''))) {
throw new CommandExecutionError('archive wayback returned malformed payload: closest snapshot is missing url/timestamp');
}
return [{
original_url: String(data.url ?? target),
requested_timestamp: timestamp,
snapshot_timestamp: String(snap.timestamp ?? ''),
snapshot_url: String(snap.url),
status: String(snap.status ?? ''),
}];
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Wait a few seconds and re-run the command — newly queued saves take time to register
- Verify the URL is reachable and correctly spelled
- Check the target manually at web.archive.org to confirm archiving is possible
- If scripting around it, catch EmptyResultError and implement a delayed retry
Example fix
// before
const out = await exec('opencli archive wayback ' + url);
// after
try {
return await exec('opencli archive wayback ' + url);
} catch (e) {
if (e.name === 'EmptyResultError') {
await new Promise(r => setTimeout(r, 10000));
return await exec('opencli archive wayback ' + url); // retry once after queue delay
}
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
try {
const out = await runWayback(url);
return out;
} catch (e) {
if (e.name === 'EmptyResultError' && e.message.includes('No Wayback snapshot')) {
await sleep(10000); // snapshot may still be processing
return runWayback(url);
}
throw e;
} Prevention
- Treat EmptyResultError as an expected outcome, not a crash
- Add a delayed retry for freshly-submitted URLs (save jobs register asynchronously)
- Verify the URL is live and archivable before scripting around it
- Batch-verify targets against web.archive.org before bulk runs
When it happens
Trigger: `opencli archive wayback <url>` where data.archived_snapshots.closest is missing, null, or has available:false — e.g. the save job has not been processed yet, or the URL has never been archived and the save was queued asynchronously.
Common situations: Archiving a brand-new URL and querying too soon before the snapshot registers; typo'd or dead URLs; the save API returning a 200 with an empty snapshots object while the job processes.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- archive wayback failed: HTTP ${resp.status}
- archive wayback returned malformed payload: closest snapshot
- No prices returned for train_no=${trainNo} ${fromStation.nam
- No 12306 stations match "${keyword}"
- No trains found from ${fromStation.name} to ${toStation.name
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/34f5ce805974d3ea.
Report an issue: GitHub.