jackwener/OpenCLI · error · CommandExecutionError
Nowcoder returned mismatched moment feed data
Error message
Nowcoder returned mismatched moment feed data
What it means
When a feed row declares contentType 74 (moment), projectFeedData requires momentData to be a record and contentData to be absent. This error means the row claims to be a moment but its payload shape says otherwise, so the library rejects it instead of projecting a broken moment post.
Source
Thrown at clis/nowcoder/posts.js:147
throw new CommandExecutionError('Nowcoder returned mismatched content feed data');
}
const post = data.contentData;
const id = requiredId(post.id, 'content id');
if ((requireOuterId || data.contentId != null) && id !== requiredId(data.contentId, 'content feed id')) {
throw new CommandExecutionError('Nowcoder returned mismatched content feed identity');
}
const uuid = requiredUuid(post.uuid, 'content uuid');
return {
...commonFeedFields(data, post, 'content', post.authorId, post.createTime, index),
id,
uuid,
entity_id: requiredId(post.entityId, 'content entity id'),
url: `https://www.nowcoder.com/discuss/${id}`,
};
}
if (data.contentType === MOMENT_TYPE) {
if (!isRecord(data.momentData) || data.contentData != null) {
throw new CommandExecutionError('Nowcoder returned mismatched moment feed data');
}
const post = data.momentData;
const entityId = requiredId(post.id, 'moment entity id');
if ((requireOuterId || data.contentId != null) && entityId !== requiredId(data.contentId, 'moment feed id')) {
throw new CommandExecutionError('Nowcoder returned mismatched moment feed identity');
}
const uuid = requiredUuid(post.uuid, 'moment uuid');
return {
...commonFeedFields(data, post, 'moment', post.userId, post.createdAt, index),
id: uuid,
uuid,
entity_id: entityId,
url: `https://www.nowcoder.com/feed/main/detail/${uuid}`,
};
}
throw new CommandExecutionError(`Nowcoder returned unsupported feed contentType ${String(data.contentType)}`);
}
View on GitHub (pinned to 49907e53dc)
Solutions
- Inspect the row's momentData/contentData to confirm what Nowcoder actually returned for contentType 74.
- Pre-filter rows missing valid momentData before calling projectNowcoderFeed.
- If Nowcoder now sends both payloads, relax the projection guard to prefer momentData.
- Re-fetch the feed in case the row was a transient partial response.
Example fix
// before const rows = projectNowcoderFeed(records, 10, 'recommend'); // after const valid = records.filter((r) => r?.data?.contentType !== 74 || r?.data?.momentData != null); const rows = projectNowcoderFeed(valid, 10, 'recommend');
Defensive patterns
Strategy: validation
Validate before calling
const isMomentRow = (d) => isRecord(d) && d.contentType === 74 && isRecord(d.momentData) && d.contentData == null;
const usable = records.filter((r) => { const d = wrapped ? r?.data : r; return d == null || isMomentRow(d) || d.contentType !== 74; }); Type guard
function isProjectableMomentRow(d) { return isRecord(d) && d.contentType === 74 && isRecord(d.momentData) && d.contentData == null; } Try / catch
try {
rows = projectNowcoderFeed(records, limit, source, wrapped);
} catch (error) {
if (String(error.message).includes('mismatched moment feed data')) {
console.error('Moment row payload missing or conflicting; inspect momentData');
}
throw error;
} Prevention
- Verify MOMENT_TYPE (74) still matches the live API
- Pre-filter rows with null momentData or stray contentData
- Keep recorded API fixtures in tests to catch schema drift
- Re-fetch on failure to rule out transient partial responses
When it happens
Trigger: A feed row with contentType===74 where momentData is null/not an object, or contentData is present alongside it.
Common situations: Deleted or restricted moments returning empty momentData while keeping the type marker; Nowcoder mixing content and moment payloads after a schema change; copy-pasted fixtures in tests with the wrong contentType; intermediate API versions returning both payloads.
Related errors
- Nowcoder returned a malformed feed row
- Nowcoder returned mismatched content feed data
- Bilibili conclusion API returned malformed model_result JSON
- Bilibili conclusion API returned malformed model_result
- ${label} returned malformed items payload
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/71387dd9633693a2.
Report an issue: GitHub.