jackwener/OpenCLI · error · CommandExecutionError
Bilibili conclusion API returned malformed part outline
Error message
Bilibili conclusion API returned malformed part outline
What it means
Each outline section should carry a part_outline array of detail points (defaulting to [] when absent). If part_outline exists but is not an array, rowsFromModel throws this CommandExecutionError because the subsequent for..of iteration over points would fail.
Source
Thrown at clis/bilibili/summary.js:114
throw new CommandExecutionError('Bilibili conclusion API returned malformed outline');
}
return { summary, outline };
}
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',View on GitHub (pinned to 49907e53dc)
Solutions
- Log section.part_outline and its type for the failing section.
- Coerce object-shaped part_outline with Object.values() before validation.
- Default to [] (skip points) when the shape is unrecognized instead of throwing.
- Retry the request — schema anomalies can be per-response.
- Compare with a working video's section shape to spot the divergence.
Example fix
// before
const points = section.part_outline ?? [];
if (!Array.isArray(points)) {
throw new CommandExecutionError('Bilibili conclusion API returned malformed part outline');
}
// after
let points = section.part_outline ?? [];
if (!Array.isArray(points)) {
points = points && typeof points === 'object' ? Object.values(points) : [];
} Defensive patterns
Strategy: validation
Validate before calling
for (const s of model?.outline ?? []) {
const po = s?.part_outline;
if (po != null && !Array.isArray(po)) console.warn('section part_outline is not an array', s?.title);
} Type guard
function hasValidPartOutline(section) {
const po = section?.part_outline;
return po === undefined || po === null || (Array.isArray(po) && po.every(p => p && typeof p === 'object'));
} Try / catch
try {
const rows = rowsFromModel(model);
} catch (e) {
if (String(e.message).includes('malformed part outline')) {
return [{ time: '', content: model.summary }];
}
throw e;
} Prevention
- Coerce object-shaped part_outline via Object.values()
- Default missing part_outline to []
- Validate section shape when caching payloads
- Compare against a known-good video's response
When it happens
Trigger: A section object has part_outline set to a non-array (object, string, number) — e.g. a Bilibili schema variant, or sections passed through a transform that collapsed the array.
Common situations: API responses where a section has subsection data serialized differently; hand-built model fixtures; caching layers that round-tripped the payload through a format losing array types.
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.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Bilibili conclusion API returned malformed outline
- Bilibili conclusion API returned malformed data
- Bilibili conclusion API returned malformed model_result
- Bilibili conclusion API returned malformed outline section
- Bilibili conclusion API returned malformed outline point
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/cf0bbc9d1c9bfb38.
Report an issue: GitHub.