{"record":{"id":"8bd7b0f792d5302c","repo":"jackwener/OpenCLI","slug":"hf-paper","errorCode":null,"errorMessage":"hf paper","messagePattern":"hf paper","errorType":"exception","errorClass":"EmptyResultError","httpStatus":404,"severity":"warning","filePath":"clis/hf/paper.js","lineNumber":42,"sourceCode":"            throw new ArgumentError('hf paper id cannot be empty', 'Example: opencli hf paper 1706.03762');\n        }\n        if (!ARXIV_ID_PATTERN.test(raw)) {\n            throw new ArgumentError(\n                `hf paper id \"${args.id}\" is not a valid arXiv id`,\n                'Expected the modern arXiv form `YYMM.NNNNN` (optionally with a version suffix like `v3`).',\n            );\n        }\n        const endpoint = process.env.HF_ENDPOINT?.replace(/\\/+$/, '') || 'https://huggingface.co';\n        const url = `${endpoint}/api/papers/${encodeURIComponent(raw)}`;\n        let resp;\n        try {\n            resp = await fetch(url, { headers: { accept: 'application/json' } });\n        }\n        catch (err) {\n            throw new CommandExecutionError(`hf paper request failed: ${err?.message ?? err}`);\n        }\n        if (resp.status === 404) {\n            throw new EmptyResultError('hf paper', `Hugging Face has no paper page for \"${raw}\".`);\n        }\n        if (resp.status === 429) {\n            throw new CommandExecutionError(\n                'hf paper returned HTTP 429 (rate limited)',\n                'Hugging Face throttles unauthenticated traffic; wait a few seconds and retry.',\n            );\n        }\n        if (!resp.ok) {\n            throw new CommandExecutionError(`hf paper returned HTTP ${resp.status}`);\n        }\n        let body;\n        try {\n            body = await resp.json();\n        }\n        catch (err) {\n            throw new CommandExecutionError(`hf paper returned malformed JSON: ${err?.message ?? err}`);\n        }\n        if (!body || typeof body !== 'object' || !body.id) {","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/hf/paper.js#L24-L60","documentation":"EmptyResultError('hf paper', 'Hugging Face has no paper page for \"<raw>\".') thrown when the Hugging Face /api/papers endpoint returns HTTP 404. It means the request succeeded but HF has no paper page for the given arXiv id — the library treats this as an 'empty result', not a hard failure.","triggerScenarios":"GET /api/papers/<id> returns 404: the arXiv id passed matches the YYMM.NNNNN pattern but HF has not mirrored that paper (very new, very obscure, or non-existent id), or the version suffix (e.g. v2) has no HF page.","commonSituations":"Developer typos an arXiv id (e.g. 1706.0376 vs 1706.03762); queries a brand-new paper before HF's paper page is generated; uses an id format that passes the regex but doesn't exist (e.g. wrong month/day digits).","solutions":["Verify the arXiv id on arxiv.org/abs/<id> — correct any typo and rerun.","Drop the version suffix: try `opencli hf paper 1706.03762` instead of `1706.03762v3`.","If the paper is brand new, wait and retry — HF generates paper pages after ingestion.","Search HF papers (huggingface.co/papers) to confirm the mirror exists before querying.","If you intended a full URL or title, convert it to the bare arXiv id first — the command only accepts ids."],"exampleFix":"// before\nopencli hf paper 1706.03762v2   // 404: versioned page missing\n// after\nopencli hf paper 1706.03762","handlingStrategy":"validation","validationCode":"const ARXIV_ID = /^\\d{4}\\.\\d{4,5}(v\\d+)?$/;\nif (!ARXIV_ID.test(id)) throw new Error(`not an arXiv id: ${id}`);\n// optionally confirm the mirror exists first:\nconst res = await fetch(`https://huggingface.co/api/papers/${id}`);\nif (res.status === 404) console.warn(`no HF paper page for ${id} — verify on arxiv.org/abs/${id}`);","typeGuard":"function isEmptyResultError(e) {\n  return e instanceof Error && e.name === 'EmptyResultError';\n}","tryCatchPattern":"try {\n  await run(['opencli', 'hf paper', id]);\n} catch (e) {\n  if (String(e.message).includes('no paper page for')) {\n    // treat as 'not found': validate id on arxiv.org, strip version suffix, or skip\n  } else throw e;\n}","preventionTips":["Copy arXiv ids directly from arxiv.org rather than typing them.","Drop the version suffix (v1/v2) when a versioned id 404s.","For brand-new papers, wait until HF generates the paper page.","Pre-check ids against the HF papers search before batch runs.","Skip-and-log missing ids in batch scripts instead of failing the whole run."],"tags":["huggingface","not-found","http-404","cli"],"backgroundTag":"resource-not-found-404","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}