jackwener/OpenCLI · error · CommandExecutionError
Sina Finance rolling news API returned malformed row ${index
Error message
Sina Finance rolling news API returned malformed row ${index + 1} What it means
CommandExecutionError thrown while mapping rows when an individual item lacks a usable title, url, or derived date. The library requires all three fields per row; a row missing any is reported as malformed with its 1-based index, so one bad row fails the whole batch.
Source
Thrown at clis/sinafinance/rolling-news.js:42
}
function normalizeRollRows(payload) {
if (payload?.result?.status?.code !== 0) {
throw new CommandExecutionError(`Sina Finance rolling news API failed: ${payload?.result?.status?.msg || 'unknown status'}`);
}
const items = payload?.result?.data;
if (!Array.isArray(items)) {
throw new CommandExecutionError('Sina Finance rolling news API returned malformed data');
}
if (items.length === 0) {
throw new EmptyResultError('sinafinance rolling-news');
}
return items.map((item, index) => {
const title = typeof item?.title === 'string' ? item.title.trim() : '';
const url = typeof item?.url === 'string' ? item.url.trim() : '';
const date = formatRollTimestamp(item?.ctime);
if (!title || !url || !date) {
throw new CommandExecutionError(`Sina Finance rolling news API returned malformed row ${index + 1}`);
}
return {
column: '财经',
title,
date,
url,
};
});
}
cli({
site: 'sinafinance',
name: 'rolling-news',
access: 'read',
description: '新浪财经滚动新闻',
domain: 'feed.mix.sina.com.cn',
strategy: Strategy.PUBLIC,
browser: false,View on GitHub (pinned to 49907e53dc)
Solutions
- Identify the offending row via the interpolated index and inspect the raw payload
- Update the CLI to skip (filter) rows with missing fields instead of throwing
- Sanitize/normalize ctime if the API changed its type (string vs number)
- Retry — the malformed row may be transient (e.g. a post being edited)
Example fix
// before
if (!title || !url || !date) {
throw new CommandExecutionError(`... malformed row ${index + 1}`);
}
// after
if (!title || !url || !date) {
console.warn(`Skipping malformed row ${index + 1}`);
return null;
} Defensive patterns
Strategy: validation
Validate before calling
// validate expected row shape upstream if you control data
function isValidRow(item) {
return typeof item?.title === 'string' && item.title.trim() !== '' &&
typeof item?.url === 'string' && item.url.trim() !== '' &&
Number.isFinite(item?.ctime);
} Type guard
function isCompleteRollItem(item) {
return typeof item?.title === 'string' && item.title.trim().length > 0 &&
typeof item?.url === 'string' && item.url.trim().length > 0 &&
item?.ctime != null;
} Try / catch
try {
const rows = await cli.rollingNews();
} catch (err) {
const m = err.message.match(/malformed row (\d+)/);
if (m) console.error(`Row ${m[1]} missing title/url/date; inspect raw payload`);
throw err;
} Prevention
- Inspect the flagged row index in the raw payload to find the missing field
- Check whether ctime came back as a string vs number
- Retry once — rows being edited can be transiently incomplete
- Patch the CLI to skip bad rows instead of failing the whole batch
When it happens
Trigger: Any item in result.data where title is not a non-empty string, url is missing/empty after trim, or ctime is absent/unparseable so formatRollTimestamp returns falsy — common with ad items, deleted posts, or rows with null fields.
Common situations: Sina including promoted/placeholder entries without URLs; rows where ctime is a string instead of a number; partially deleted feed items retaining empty titles.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- ${label} returned a malformed numeric field
- Zhihu answer comments contained a ${role} row without a stab
- Zhihu answer comment ${id} did not identify its immediate pa
- Zhihu answer root comment ${id} had malformed child count
- Zhihu search returned malformed result row identity
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1b4bd269a95f1b9d.
Report an issue: GitHub.