jackwener/OpenCLI · warning · EmptyResultError
No Wayback snapshots for "${target}".
Error message
No Wayback snapshots for "${target}". What it means
The CDX API returned a valid array-of-arrays payload, but it contains fewer than two rows — meaning only a header (or nothing at all), i.e. zero snapshots for the requested URL and time range. Unlike the malformed-payload errors, this is raised as `EmptyResultError` because it is a normal 'no data' outcome, not corruption.
Source
Thrown at clis/archive/snapshots.js:93
} catch (error) {
throw new CommandExecutionError(`archive snapshots request failed: ${error?.message || error}`);
}
if (!resp.ok) {
throw new CommandExecutionError(`archive snapshots failed: HTTP ${resp.status}`);
}
let data;
try {
data = await resp.json();
} catch (error) {
throw new CommandExecutionError(`archive snapshots returned malformed JSON: ${error?.message || error}`);
}
// CDX returns an array of arrays; the first row is the header.
if (!Array.isArray(data)) {
throw new CommandExecutionError('archive snapshots returned malformed CDX payload: top-level payload must be an array');
}
if (data.length < 2) {
throw new EmptyResultError('archive snapshots', `No Wayback snapshots for "${target}".`);
}
const [header, ...rows] = data;
if (!Array.isArray(header)) {
throw new CommandExecutionError('archive snapshots returned malformed CDX payload: header row must be an array');
}
const cols = {};
header.forEach((name, i) => { cols[name] = i; });
const timestampCol = requireCdxColumn(cols, 'timestamp');
const originalCol = requireCdxColumn(cols, 'original');
const statusCol = requireCdxColumn(cols, 'statuscode');
const mimetypeCol = requireCdxColumn(cols, 'mimetype');
return rows.slice(0, limit).map(row => {
if (!Array.isArray(row)) {
throw new CommandExecutionError('archive snapshots returned malformed CDX payload: snapshot row must be an array');
}
const timestamp = String(row[timestampCol] ?? '');
const original = String(row[originalCol] ?? '');View on GitHub (pinned to 49907e53dc)
Solutions
- Verify the URL/domain spelling and try a broader form (e.g. `example.com` instead of a deep path).
- Widen or drop the `from`/`to` time range to cover the site's full history.
- Check the site manually at https://web.archive.org to confirm it has any captures.
- Treat the empty result as expected and handle `EmptyResultError` gracefully in your tooling.
Example fix
// before: narrow window predating the site
await exec('opencli archive snapshots example.com --from 1990 --to 1991');
// after: widen the window
await exec('opencli archive snapshots example.com --from 1996 --to 2026'); Defensive patterns
Strategy: validation
Validate before calling
// Check the site has captures before invoking
const r = await fetch('https://archive.org/wayback/available?url=' + encodeURIComponent(target));
const j = await r.json();
if (!j?.archived_snapshots?.closest) console.warn('No Wayback captures for', target); Try / catch
try {
await exec('opencli archive snapshots example.com --from 1996 --to 2026');
} catch (e) {
if (String(e.message).includes('No Wayback snapshots for')) {
return []; // expected empty result — handle gracefully
} else throw e;
} Prevention
- Verify the URL exists in the Wayback Machine before batch queries
- Double-check domain spelling and path casing
- Widen from/to ranges to the site's plausible lifetime
- Treat empty results as data, not faults, in pipelines
When it happens
Trigger: Calling `archive snapshots` with a URL that the Wayback Machine has never archived, a misspelled domain, a `from`/`to` window outside the site's archived history, or a URL scheme/query combination CDX cannot match.
Common situations: Querying brand-new or obscure sites never crawled by the Wayback Machine; restricting `--from`/`--to` to years before the site existed; trailing-slash or path-case mismatches versus what was archived; typos in the domain.
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
- No trains found from ${fromStation.name} to ${toStation.name
- NO_DATA
- archive snapshots returned malformed CDX payload: top-level
- archive snapshots returned malformed CDX payload: snapshot r
- archive snapshots returned malformed CDX payload: snapshot r
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/dd3c91e00b831694.
Report an issue: GitHub.