jackwener/OpenCLI · warning · CliError

NOT_FOUND

NOT_FOUND

Error message

Article "${args.title}" not found

What it means

CliError with code NOT_FOUND thrown by `opencli wikipedia summary` when the REST summary endpoint /api/rest_v1/page/summary/<title> returns a body without a title field, meaning no article with that exact title exists on that language edition. The hint points to the search subcommand.

Source

Thrown at clis/wikipedia/summary.js:21

import { formatSummaryRow, wikiFetch } from './utils.js';
cli({
    site: 'wikipedia',
    name: 'summary',
    access: 'read',
    description: 'Get Wikipedia article summary',
    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'title', positional: true, required: true, help: 'Article title (e.g. "Transformer (machine learning model)")' },
        { name: 'lang', default: 'en', help: 'Language code (e.g. en, zh, ja)' },
    ],
    columns: ['title', 'description', 'extract', 'url'],
    func: async (args) => {
        const lang = args.lang || 'en';
        const title = encodeURIComponent(args.title.replace(/ /g, '_'));
        const data = (await wikiFetch(lang, `/api/rest_v1/page/summary/${title}`));
        if (!data?.title)
            throw new CliError('NOT_FOUND', `Article "${args.title}" not found`, 'Try searching first: opencli wikipedia search <keyword>');
        return [formatSummaryRow(data, lang)];
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Run `opencli wikipedia search <keyword>` first and use an exact result title
  2. Check spelling and capitalization of the title
  3. Verify the article exists on <lang>.wikipedia.org in a browser
  4. Try another --lang edition

Example fix

// before
opencli wikipedia summary "Python (programming langage)"
// after
opencli wikipedia search "Python programming"
opencli wikipedia summary "Python (programming language)"
Defensive patterns

Strategy: fallback

Type guard

function isSummary(d) {
  return !!d && typeof d === 'object' && typeof d.title === 'string' && d.title.length > 0;
}

Try / catch

try {
  const rows = await run('wikipedia summary', [title, '--lang', lang]);
} catch (e) {
  if (e.code === 'NOT_FOUND') {
    const hits = await run('wikipedia search', [title, '--lang', lang]);
    if (hits.length) return run('wikipedia summary', [hits[0].title, '--lang', lang]);
    throw e;
  }
  throw e;
}

Prevention

When it happens

Trigger: `opencli wikipedia summary <title> --lang <lang>` where the REST API answers with a non-summary body (missing/404) lacking data.title — misspelled titles, wrong language edition, or REST API error responses (the REST endpoint returns 200 with error JSON in some cases, or wikiFetch already caught real HTTP errors).

Common situations: Using a display title with disambiguation instead of the canonical one, article exists in another language only, recent renames/deletions, typos.

Understand the failure class

Background: NOT_FOUND error code: why tRPC, Harbor, Nacos and other libraries return 404 "not found" errors for resources that may still exist — this error's family across 11 libraries.

Related errors


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