jackwener/OpenCLI · warning · EmptyResultError

bilibili creator-stats ${bvid}

Error message

bilibili creator-stats ${bvid}

What it means

If no row in the latest 100 comparison rows matches the requested bvid, selectTarget throws EmptyResultError with the query identifier 'bilibili creator-stats <bvid>'. Unlike the other errors this is an 'empty result' signal, not a failure: the request succeeded but the manuscript simply was not in the returned analytics window. The hint explains the likely reasons.

Source

Thrown at clis/bilibili/creator-stats.js:105

            throw new AuthRequiredError('member.bilibili.com', `Bilibili creator-center login is required: ${detail}`);
        }
        throw new CommandExecutionError(`Bilibili creator comparison request failed: ${detail}`);
    }
}

function selectTarget(list, bvid) {
    const matches = [];
    for (const item of list) {
        if (!isRecord(item) || typeof item.bvid !== 'string' || !/^BV[0-9A-Za-z]{10}$/.test(item.bvid)) {
            throw new CommandExecutionError('Bilibili creator comparison returned a malformed manuscript row');
        }
        if (item.bvid === bvid) matches.push(item);
    }
    if (matches.length > 1) {
        throw new CommandExecutionError(`Bilibili creator comparison returned duplicate rows for ${bvid}`);
    }
    if (matches.length === 0) {
        throw new EmptyResultError(
            `bilibili creator-stats ${bvid}`,
            'The manuscript was not present in the latest 100 creator analytics rows; it may be older, not owned by this account, or not analyzed yet.',
        );
    }
    const target = matches[0];
    if (!isRecord(target.stat)) {
        throw new CommandExecutionError(`Bilibili creator comparison returned malformed stat data for ${bvid}`);
    }
    return target;
}

function metricValue(target, definition) {
    const source = definition.source === 'target' ? target : target.stat;
    if (!Object.prototype.hasOwnProperty.call(source, definition.key)) {
        throw new CommandExecutionError(`Bilibili creator comparison omitted metric ${definition.key}`);
    }
    const raw = source[definition.key];
    if (raw === null) return null;

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Double-check the BV ID for typos and case (or pass the full video URL, which parseBvidOrVideoUrl normalizes)
  2. Wait and retry — new uploads may take time before creator analytics are generated
  3. Verify the logged-in account owns the manuscript; the endpoint only returns the current account's rows
  4. If the video is older than your latest 100 uploads, it is outside this endpoint's window — use another data source

Example fix

// before: wrong-case / wrong video
$ opencli bilibili creator-stats bv1xx411c7mD
EmptyResultError: bilibili creator-stats bv1xx411c7mD — not present in latest 100 rows

// after: exact case-sensitive BV or full URL
$ opencli bilibili creator-stats BV1xx411c7mD
Defensive patterns

Strategy: validation

Validate before calling

const bvid = 'BV1xx411c7mD';
if (!/^BV[0-9A-Za-z]{10}$/.test(bvid)) throw new Error('Invalid BV ID — must be BV followed by 10 alphanumeric chars (case-sensitive)');

Type guard

function isValidBvid(v) {
  return typeof v === 'string' && /^BV[0-9A-Za-z]{10}$/.test(v);
}

Try / catch

try {
  const rows = await runCommand();
} catch (e) {
  if (e.name === 'EmptyResultError') {
    // not an outage: check BV spelling/case, account ownership, analytics lag, or 100-row window
  } else throw e;
}

Prevention

When it happens

Trigger: fetchComparison returned a valid list, every row passed whitelisting, but none has item.bvid === the requested BV — the video is outside the latest-100 window, not owned by this account, or has no analytics yet.

Common situations: Querying a video older than the most recent 100 manuscripts; typo'd or wrong-case BV ID (matching is case-sensitive); querying another creator's video while logged into your own account; brand-new upload not yet analyzed.

Related errors


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