{"record":{"id":"bca649bbb0a8c923","repo":"jackwener/OpenCLI","slug":"dblp-label-cannot-be-empty","errorCode":null,"errorMessage":"dblp ${label} cannot be empty","messagePattern":"dblp (.+?) cannot be empty","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/dblp/utils.js","lineNumber":107,"sourceCode":"    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)) {\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 '';","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/dblp/utils.js#L89-L125","documentation":"Thrown by requireQuery when the query argument is missing, empty, or only whitespace. A dblp search (publications, venues, author names) needs a non-empty query string.","triggerScenarios":"Running a dblp search/venue/author command without the positional query, with '' or only spaces, or with a shell variable that expanded to empty.","commonSituations":"Forgetting the search term on the CLI; unset environment/shell variables (q=\"$MY_QUERY\" with MY_QUERY empty); copying a command template without filling in the query.","solutions":["Provide a non-empty search term, e.g. dblp search \"vector databases\"","Check that any shell variable holding the query is set and non-empty","Quote the query so spaces survive shell word-splitting","Trim input in scripts before passing it"],"exampleFix":"// before\nconst query = process.env.Q; // undefined\nrunSearch(query);\n// after\nconst query = process.env.Q ?? '';\nif (query.trim()) runSearch(query.trim());\nelse console.error('Set Q to a non-empty search term');","handlingStrategy":"validation","validationCode":"const query = (process.argv[3] ?? '').trim();\nif (!query) {\n  console.error('Usage: dblp search \"<query>\"');\n  process.exit(2);\n}","typeGuard":"function isNonEmptyString(v) { return typeof v === 'string' && v.trim().length > 0; }","tryCatchPattern":"try {\n  const rows = await dblpVenueSearch(rawQuery);\n} catch (err) {\n  if (/cannot be empty/.test(err.message)) {\n    console.error('Provide a non-empty search term, e.g. dblp venue \"NeurIPS\"');\n    process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Always trim and check query input before invoking the command","Default empty shell variables explicitly: Q=\"${Q:-fallback}\"","Quote queries containing spaces","Show usage text when the positional argument is missing"],"tags":["validation","arguments","cli","input"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}