{"record":{"id":"a6cb71c4a1042812","repo":"jackwener/OpenCLI","slug":"dblp-label-must-be-maxvalue","errorCode":null,"errorMessage":"dblp ${label} must be <= ${maxValue}","messagePattern":"dblp (.+?) must be <= (.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/dblp/utils.js","lineNumber":99,"sourceCode":"export async function dblpFetchXml(path, label) {\n    const res = await dblpFetch(`${DBLP_ORIGIN}${path}`, label, 'application/xml');\n    return res.text();\n}\n\nexport function coerceInt(value) {\n    if (value === undefined || value === null || value === '') return NaN;\n    const n = typeof value === 'number' ? value : Number(value);\n    return Number.isFinite(n) && Number.isInteger(n) ? n : NaN;\n}\n\nexport function requireBoundedInt(value, defaultValue, maxValue, label = 'limit') {\n    const raw = value ?? defaultValue;\n    const n = coerceInt(raw);\n    if (!Number.isInteger(n) || n <= 0) {\n        throw new ArgumentError(`dblp ${label} must be a positive integer`);\n    }\n    if (n > maxValue) {\n        throw new ArgumentError(`dblp ${label} must be <= ${maxValue}`);\n    }\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)) {","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/dblp/utils.js#L81-L117","documentation":"Thrown by requireBoundedInt when the value coerces to a positive integer but exceeds the allowed maximum for that option (e.g. limit > 100 for search/venue). It caps request sizes to keep dblp responses reasonable.","triggerScenarios":"Calling a dblp command with --limit 500 when the command's maxValue is 100, or any value above the command-specific cap.","commonSituations":"Assuming the limit is unbounded; copying a limit from another command with a higher cap; scripts computing page sizes larger than dblp's supported h= maximum.","solutions":["Lower the value to at most the maximum (e.g. --limit 100)","Read the command's help to see its specific max","Paginate multiple smaller requests instead of one huge request","Remove the flag to use the built-in default"],"exampleFix":"// before\nnode cli.js dblp search --limit 500\n// after\nnode cli.js dblp search --limit 100","handlingStrategy":"validation","validationCode":"function clampLimit(raw, def = 20, max = 100) {\n  if (raw === undefined || raw === null || raw === '') return def;\n  const n = Number(raw);\n  if (!Number.isInteger(n) || n <= 0) throw new Error(`--limit must be a positive integer, got \"${raw}\"`);\n  return Math.min(n, max);\n}","typeGuard":"function isWithinBound(v, max) { return typeof v === 'number' && Number.isInteger(v) && v > 0 && v <= max; }","tryCatchPattern":"try {\n  runDblpSearch(args);\n} catch (err) {\n  if (/must be <= \\d+/.test(err.message)) {\n    console.error('Lower --limit (search/venue allow at most 100)');\n    process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Clamp user-provided limits to the documented max before calling","Check each command's help for its specific cap","Paginate with multiple calls instead of raising the limit","Share a single clamping helper across dblp commands"],"tags":["validation","arguments","cli","limits"],"backgroundTag":"argument-out-of-range","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}