{"record":{"id":"2658f0450c23e01d","repo":"jackwener/OpenCLI","slug":"dblp-paper-key-value-is-not-a-valid-record-ke","errorCode":null,"errorMessage":"dblp paper key \"${value}\" is not a valid record key","messagePattern":"dblp paper key \"(.+?)\" is not a valid record key","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/dblp/utils.js","lineNumber":118,"sourceCode":"    }\n    return n;\n}\n\nexport function requireQuery(value, label = 'query') {\n    const q = String(value ?? '').trim();\n    if (!q) {\n        throw new ArgumentError(`dblp ${label} cannot be empty`);\n    }\n    return q;\n}\n\nexport function requireRecordKey(value) {\n    const key = String(value ?? '').trim();\n    if (!key) {\n        throw new ArgumentError('dblp paper key is required');\n    }\n    if (!KEY_PATTERN.test(key)) {\n        throw new ArgumentError(`dblp paper key \"${value}\" is not a valid record key`, 'Expected something like \"conf/nips/VaswaniSPUJGKP17\" — copy the `key` column from `dblp search`.');\n    }\n    return key;\n}\n\n/** Decode the small set of XML entities dblp emits in record bodies. */\nexport function decodeXmlEntities(text) {\n    if (!text) return '';\n    return String(text)\n        .replace(/&amp;/g, '&')\n        .replace(/&lt;/g, '<')\n        .replace(/&gt;/g, '>')\n        .replace(/&apos;/g, \"'\")\n        .replace(/&quot;/g, '\"')\n        .replace(/&#x([0-9a-fA-F]+);/g, (_, h) => String.fromCodePoint(parseInt(h, 16)))\n        .replace(/&#(\\d+);/g, (_, d) => String.fromCodePoint(parseInt(d, 10)));\n}\n\n/** Strip dblp's per-author homonym suffixes (`Smith 0001`) → `Smith`. */","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/dblp/utils.js#L100-L136","documentation":"Thrown by requireRecordKey when the supplied key does not match KEY_PATTERN (/^[a-z]+(\\/[A-Za-z0-9_.-]+)+$/) — dblp record keys must look like <type>/<venue>/<short>. Failing this check locally avoids a guaranteed 404 from dblp.","triggerScenarios":"Passing a full dblp URL instead of the bare key, a DOI, a title, a key with spaces or invalid characters, or a key missing the slash-separated segments.","commonSituations":"Pasting https://dblp.org/rec/conf/nips/... instead of conf/nips/VaswaniSPUJGKP17; passing a DOI like 10.1145/...; typos or trailing slashes in copied keys.","solutions":["Copy the key from the `key` column of `dblp search` output rather than the URL","Strip any URL/https://dblp.org/rec/ prefix and .html/.xml suffix, keeping the bare key","Ensure the key has at least one slash and only letters/digits/_/./- in segments","Verify against the pattern: e.g. journals/corr/abs-2509-05821 or phd/Smith20"],"exampleFix":"// before\nnode cli.js dblp paper \"https://dblp.org/rec/conf/nips/VaswaniSPUJGKP17.html\"\n// after\nnode cli.js dblp paper \"conf/nips/VaswaniSPUJGKP17\"","handlingStrategy":"validation","validationCode":"const KEY_PATTERN = /^[a-z]+(?:\\/[A-Za-z0-9_.-]+)+$/;\nfunction normalizeKey(input) {\n  return String(input)\n    .replace(/^https?:\\/\\/dblp\\.org\\/rec\\//, '')\n    .replace(/\\.(html|xml|json)$/, '')\n    .trim();\n}\nconst key = normalizeKey(raw);\nif (!KEY_PATTERN.test(key)) throw new Error(`Invalid dblp key: \"${raw}\" — expected e.g. conf/nips/VaswaniSPUJGKP17`);","typeGuard":"function isValidRecordKey(v) { return typeof v === 'string' && /^[a-z]+(?:\\/[A-Za-z0-9_.-]+)+$/.test(v.trim()); }","tryCatchPattern":"try {\n  const row = await dblpPaper(rawKey);\n} catch (err) {\n  if (/not a valid record key/.test(err.message)) {\n    console.error('Copy the bare key (e.g. conf/nips/VaswaniSPUJGKP17) from the `key` column of `dblp search`');\n    process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Copy keys from the `key` column of `dblp search`, not the URL bar","Strip URL prefixes and .html/.xml suffixes before passing keys","Remember DOIs and titles are not record keys","Validate with the key pattern (letters prefix + slash segments) before calling"],"tags":["validation","arguments","format","dblp"],"backgroundTag":"invalid-identifier-format","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}