jackwener/OpenCLI · error · ArgumentError
dblp ${label} cannot be empty
Error message
dblp ${label} cannot be empty What it means
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.
Source
Thrown at clis/dblp/utils.js:107
return Number.isFinite(n) && Number.isInteger(n) ? n : NaN;
}
export function requireBoundedInt(value, defaultValue, maxValue, label = 'limit') {
const raw = value ?? defaultValue;
const n = coerceInt(raw);
if (!Number.isInteger(n) || n <= 0) {
throw new ArgumentError(`dblp ${label} must be a positive integer`);
}
if (n > maxValue) {
throw new ArgumentError(`dblp ${label} must be <= ${maxValue}`);
}
return n;
}
export function requireQuery(value, label = 'query') {
const q = String(value ?? '').trim();
if (!q) {
throw new ArgumentError(`dblp ${label} cannot be empty`);
}
return q;
}
export function requireRecordKey(value) {
const key = String(value ?? '').trim();
if (!key) {
throw new ArgumentError('dblp paper key is required');
}
if (!KEY_PATTERN.test(key)) {
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`.');
}
return key;
}
/** Decode the small set of XML entities dblp emits in record bodies. */
export function decodeXmlEntities(text) {
if (!text) return '';View on GitHub (pinned to 49907e53dc)
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
Example fix
// before
const query = process.env.Q; // undefined
runSearch(query);
// after
const query = process.env.Q ?? '';
if (query.trim()) runSearch(query.trim());
else console.error('Set Q to a non-empty search term'); Defensive patterns
Strategy: validation
Validate before calling
const query = (process.argv[3] ?? '').trim();
if (!query) {
console.error('Usage: dblp search "<query>"');
process.exit(2);
} Type guard
function isNonEmptyString(v) { return typeof v === 'string' && v.trim().length > 0; } Try / catch
try {
const rows = await dblpVenueSearch(rawQuery);
} catch (err) {
if (/cannot be empty/.test(err.message)) {
console.error('Provide a non-empty search term, e.g. dblp venue "NeurIPS"');
process.exitCode = 2;
} else throw err;
} Prevention
- 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
When it happens
Trigger: Running a dblp search/venue/author command without the positional query, with '' or only spaces, or with a shell variable that expanded to empty.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- dblp ${label} must be a positive integer
- dblp paper key is required
- ${label} is required
- ${label} must be a positive integer
- ${label} must be <= ${maxValue}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/bca649bbb0a8c923.
Report an issue: GitHub.