jackwener/OpenCLI · error · ArgumentError

dblp pid "${pidArg}" is not a valid PID

Error message

dblp pid "${pidArg}" is not a valid PID

What it means

ArgumentError thrown before any network call when the --pid argument does not match dblp's PID pattern (e.g. '56/953'). dblp author IDs are of the form 'letters/digits', and the library validates the format up front to fail fast with a helpful hint.

Source

Thrown at clis/dblp/author.js:78

    access: 'read',
    description: 'List dblp publications by a given author (newest first; resolves to top PID match)',
    domain: 'dblp.org',
    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'author', positional: true, required: false, help: 'Author name (e.g. "Yoshua Bengio"). Optional when --pid is given.' },
        { name: 'pid', help: 'Canonical dblp PID (e.g. "56/953"). Bypasses author search.' },
        { name: 'limit', type: 'int', default: 20, help: 'Max publications (1-200)' },
    ],
    columns: ['rank', 'key', 'title', 'authors', 'venue', 'year', 'type', 'doi', 'pid', 'url'],
    func: async (args) => {
        const limit = requireBoundedInt(args.limit, 20, 200);
        const pidArg = args.pid != null ? String(args.pid).trim() : '';
        let pid = '';
        let resolvedName = '';
        if (pidArg) {
            if (!PID_PATTERN.test(pidArg)) {
                throw new ArgumentError(
                    `dblp pid "${pidArg}" is not a valid PID`,
                    'Expected something like "56/953" — visit the author page on dblp.org to find it.',
                );
            }
            pid = pidArg;
        }
        else {
            const name = requireQuery(args.author, 'author');
            const json = await dblpFetchJson(
                `/search/author/api?q=${encodeURIComponent(name)}&format=json&h=20`,
                'dblp author search',
            );
            const raw = json?.result?.hits?.hit;
            const hits = Array.isArray(raw) ? raw : (raw ? [raw] : []);
            if (!hits.length) {
                throw new EmptyResultError(
                    'dblp author',
                    `No dblp author matched "${name}". Try a different spelling, or pass --pid to bypass author search.`,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Visit the author's page on dblp.org and copy the pid portion (e.g. '56/953') from the URL
  2. Strip any URL prefix — pass only the 'xx/nnn' segment, not the full link
  3. Omit --pid entirely and let the CLI resolve the author by name
  4. Check for stray quotes/whitespace when copying the PID

Example fix

// before
opencli dblp author --pid https://dblp.org/pid/56/953.html
// Error: dblp pid "https://dblp.org/pid/56/953.html" is not a valid PID
// after
opencli dblp author --pid 56/953
Defensive patterns

Strategy: validation

Validate before calling

const PID_PATTERN = /^[a-z]+\/\d+$/i;
if (!pidArg || !PID_PATTERN.test(String(pidArg).trim())) {
  throw new Error(`--pid must look like "56/953", got: ${pidArg}`);
}

Type guard

function isValidDblpPid(v) {
  return typeof v === 'string' && /^[a-z]+\/\d+$/.test(v.trim());
}

Try / catch

try {
  await dblpAuthor({ pid: pidArg });
} catch (err) {
  if (/is not a valid PID/.test(err.message)) {
    console.error('Pass only the xx/nnn segment of the dblp URL, not the full URL.');
  } else throw err;
}

Prevention

When it happens

Trigger: Calling `dblp author --pid <value>` where value lacks the 'xx/nnn' shape — e.g. a full dblp URL pasted whole, a name instead of a PID, whitespace-mangled input, or a truncated PID like '56'.

Common situations: Pasting 'https://dblp.org/pid/56/953.html' instead of just '56/953'; typo such as '56-953'; passing an ORCID or Google Scholar ID by mistake.

Related errors


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