jackwener/OpenCLI · error · CommandExecutionError

Bilibili conclusion API returned malformed outline point

Error message

Bilibili conclusion API returned malformed outline point

What it means

Within part_outline, each point must be a non-null, non-array object so its content/timestamp can be read safely. This CommandExecutionError fires when a point entry is null, a scalar, or an array, preventing crashes when building the time/content rows.

Source

Thrown at clis/bilibili/summary.js:118

function rowsFromModel(model) {
    const rows = [{ time: '', content: model.summary }];
    for (const section of model.outline) {
        if (!section || typeof section !== 'object' || Array.isArray(section)) {
            throw new CommandExecutionError('Bilibili conclusion API returned malformed outline section');
        }
        const sectionTitle = String(section.title ?? '').trim();
        const sectionTime = formatTime(section.timestamp);
        if (sectionTitle) {
            rows.push({ time: sectionTime, content: `# ${sectionTitle}` });
        }
        const points = section.part_outline ?? [];
        if (!Array.isArray(points)) {
            throw new CommandExecutionError('Bilibili conclusion API returned malformed part outline');
        }
        for (const point of points) {
            if (!point || typeof point !== 'object' || Array.isArray(point)) {
                throw new CommandExecutionError('Bilibili conclusion API returned malformed outline point');
            }
            const content = String(point.content ?? '').trim();
            if (content) {
                rows.push({ time: formatTime(point.timestamp), content });
            }
        }
    }
    return rows;
}

var command = cli({
    site: 'bilibili',
    name: 'summary',
    access: 'read',
    description: '获取 B站视频的官方 AI 总结(视频页「AI总结」同款,含分段大纲与时间戳)',
    domain: 'www.bilibili.com',
    strategy: Strategy.COOKIE,
    args: [

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Log JSON.stringify of the failing points array to find the bad entry.
  2. Skip invalid points with a filter: points.filter(p => p && typeof p === 'object' && !Array.isArray(p)).
  3. Retry the conclusion request to rule out a transient bad payload.
  4. Validate point shape when caching, not just when rendering.
  5. Check for recent changes in the conclusion API's part_outline entries.

Example fix

// before
for (const point of points) {
    if (!point || typeof point !== 'object' || Array.isArray(point)) {
        throw new CommandExecutionError('Bilibili conclusion API returned malformed outline point');
    }
// after
for (const point of points) {
    if (!point || typeof point !== 'object' || Array.isArray(point)) {
        console.warn('skipping malformed outline point', point);
        continue;
    }
Defensive patterns

Strategy: validation

Validate before calling

const validPoints = (section?.part_outline ?? []).filter(
  p => p && typeof p === 'object' && !Array.isArray(p)
);
if (validPoints.length !== (section?.part_outline ?? []).length) console.warn('some outline points invalid');

Type guard

function isOutlinePoint(p) {
  return !!p && typeof p === 'object' && !Array.isArray(p) && ('content' in p || 'timestamp' in p);
}

Try / catch

try {
  const rows = rowsFromModel(model);
} catch (e) {
  if (String(e.message).includes('malformed outline point')) {
    return [{ time: '', content: model.summary }];
  }
  throw e;
}

Prevention

When it happens

Trigger: A part_outline array contains null or non-object entries — placeholder/sentinel values from the API, truncated data, or incorrectly deserialized cached payloads.

Common situations: Videos with partially generated AI outlines; cache layers losing element types; unit-test fixtures with sloppy data.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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