jackwener/OpenCLI · error · ArgumentError

openreview search query cannot be empty

Error message

openreview search query cannot be empty

What it means

The openreview search command requires a non-empty query term. If args.query is missing, empty, or only whitespace, ArgumentError is thrown before any API request, because an empty term would produce a meaningless search request.

Source

Thrown at clis/openreview/search.js:24

import { noteToRow, openreviewFetch, requireBoundedInt } from './utils.js';

cli({
    site: 'openreview',
    name: 'search',
    access: 'read',
    description: 'Search OpenReview papers by free-text query',
    domain: 'openreview.net',
    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'query', positional: true, required: true, help: 'Search keyword (e.g. "diffusion model")' },
        { name: 'limit', type: 'int', default: 25, help: 'Max results (max 50)' },
    ],
    columns: ['rank', 'id', 'title', 'authors', 'venue', 'pdate', 'url'],
    func: async (args) => {
        const term = String(args.query ?? '').trim();
        if (!term) {
            throw new ArgumentError('openreview search query cannot be empty');
        }
        const limit = requireBoundedInt(args.limit, 25, 50);
        const path = `/notes/search?term=${encodeURIComponent(term)}&type=terms&limit=${limit}`;
        const json = await openreviewFetch(path, 'openreview search');
        const notes = Array.isArray(json?.notes) ? json.notes : [];
        if (!notes.length) {
            throw new EmptyResultError('openreview', `No papers found for "${term}". Try a different keyword.`);
        }
        return notes.slice(0, limit).map((note, i) => {
            const row = noteToRow(note);
            return {
                rank: i + 1,
                id: row.id,
                title: row.title,
                authors: row.authors,
                venue: row.venue,
                pdate: row.pdate,
                url: row.url,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Provide a non-empty search term, e.g. openreview search "transformer attention"
  2. Quote the query in the shell to preserve spaces
  3. Check the script/CI variable feeding --query is set and non-empty
  4. Trim stray whitespace-only values before passing

Example fix

// before
openreview search --query ""
// after
openreview search --query "vision transformer"
Defensive patterns

Strategy: validation

Validate before calling

const term = String(rawQuery ?? '').trim();
if (!term) {
    throw new Error('Search query must be a non-empty string');
}

Prevention

When it happens

Trigger: args.query is undefined, '', or whitespace-only after String().trim() when invoking the search command.

Common situations: Forgetting the --query flag entirely; passing --query "" from a script variable that was empty; shells stripping quotes leaving an empty argument; CI pipelines with unset environment variables interpolated into the flag.

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


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/11591eb628164c68. Report an issue: GitHub.