{"record":{"id":"dd3c91e00b831694","repo":"jackwener/OpenCLI","slug":"no-wayback-snapshots-for-target","errorCode":null,"errorMessage":"No Wayback snapshots for \"${target}\".","messagePattern":"No Wayback snapshots for \"(.+?)\"\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/archive/snapshots.js","lineNumber":93,"sourceCode":"        } catch (error) {\n            throw new CommandExecutionError(`archive snapshots request failed: ${error?.message || error}`);\n        }\n        if (!resp.ok) {\n            throw new CommandExecutionError(`archive snapshots failed: HTTP ${resp.status}`);\n        }\n        let data;\n        try {\n            data = await resp.json();\n        } catch (error) {\n            throw new CommandExecutionError(`archive snapshots returned malformed JSON: ${error?.message || error}`);\n        }\n\n        // CDX returns an array of arrays; the first row is the header.\n        if (!Array.isArray(data)) {\n            throw new CommandExecutionError('archive snapshots returned malformed CDX payload: top-level payload must be an array');\n        }\n        if (data.length < 2) {\n            throw new EmptyResultError('archive snapshots', `No Wayback snapshots for \"${target}\".`);\n        }\n        const [header, ...rows] = data;\n        if (!Array.isArray(header)) {\n            throw new CommandExecutionError('archive snapshots returned malformed CDX payload: header row must be an array');\n        }\n        const cols = {};\n        header.forEach((name, i) => { cols[name] = i; });\n        const timestampCol = requireCdxColumn(cols, 'timestamp');\n        const originalCol = requireCdxColumn(cols, 'original');\n        const statusCol = requireCdxColumn(cols, 'statuscode');\n        const mimetypeCol = requireCdxColumn(cols, 'mimetype');\n\n        return rows.slice(0, limit).map(row => {\n            if (!Array.isArray(row)) {\n                throw new CommandExecutionError('archive snapshots returned malformed CDX payload: snapshot row must be an array');\n            }\n            const timestamp = String(row[timestampCol] ?? '');\n            const original = String(row[originalCol] ?? '');","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/archive/snapshots.js#L75-L111","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: narrow window predating the site\nawait exec('opencli archive snapshots example.com --from 1990 --to 1991');\n// after: widen the window\nawait exec('opencli archive snapshots example.com --from 1996 --to 2026');","handlingStrategy":"validation","validationCode":"// Check the site has captures before invoking\nconst r = await fetch('https://archive.org/wayback/available?url=' + encodeURIComponent(target));\nconst j = await r.json();\nif (!j?.archived_snapshots?.closest) console.warn('No Wayback captures for', target);","typeGuard":null,"tryCatchPattern":"try {\n  await exec('opencli archive snapshots example.com --from 1996 --to 2026');\n} catch (e) {\n  if (String(e.message).includes('No Wayback snapshots for')) {\n    return []; // expected empty result — handle gracefully\n  } else throw e;\n}","preventionTips":["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"],"tags":["empty-result","wayback-machine","cdx-api","no-data"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}