jackwener/OpenCLI · error · CommandExecutionError
Nowcoder returned mismatched moment feed identity
Error message
Nowcoder returned mismatched moment feed identity
What it means
For moment-type feed rows, momentData.id (the entity id) must equal the outer row's contentId whenever the outer id is required or present. This error means the moment payload's entity id does not match the id the envelope advertised, so the row is treated as inconsistent and rejected.
Source
Thrown at clis/nowcoder/posts.js:152
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)}`);
}
export function projectNowcoderFeed(records, limit, source, wrapped = false) {
if (!Array.isArray(records)) throw new CommandExecutionError(`Nowcoder ${source} returned malformed records`);
const rows = [];
for (const record of records) {
const data = wrapped ? record?.data : record;View on GitHub (pinned to 49907e53dc)
Solutions
- Compare momentData.id with data.contentId on the offending row to determine the authoritative identifier.
- Drop the forced outer-id requirement by not using wrapped mode or source='experience' if the API no longer guarantees it.
- Pre-filter rows where momentData.id !== contentId before projection.
- Update the identity check if Nowcoder changed the meaning of contentId for moments.
Example fix
// before
rows.push(projectFeedData(data, rows.length, source === 'experience' || wrapped));
// after
if (data?.contentId == null || String(data?.momentData?.id) === String(data.contentId)) {
rows.push(projectFeedData(data, rows.length, source === 'experience' || wrapped));
} Defensive patterns
Strategy: validation
Validate before calling
const momentIdsMatch = (d) => d?.contentId == null || String(d?.momentData?.id) === String(d.contentId);
const usable = records.filter((r) => { const d = wrapped ? r?.data : r; return d?.contentType !== 74 || momentIdsMatch(d); }); Type guard
function hasConsistentMomentIdentity(d) { return isRecord(d) && (d.contentId == null || String(d.momentData?.id) === String(d.contentId)); } Try / catch
try {
rows = projectNowcoderFeed(records, limit, source, wrapped);
} catch (error) {
if (String(error.message).includes('mismatched moment feed identity')) {
rows = projectNowcoderFeed(records.filter((r) => hasConsistentMomentIdentity(wrapped ? r?.data : r)), limit, source, wrapped);
} else throw error;
} Prevention
- Confirm which identifier Nowcoder places in contentId for moments (entity id vs uuid)
- Pre-filter rows where momentData.id !== contentId
- Avoid forcing wrapped mode unless the source guarantees outer ids
- Never merge feed rows from multiple fetches
When it happens
Trigger: A contentType-74 row where (requireOuterId || data.contentId != null) and requiredId(momentData.id) !== requiredId(data.contentId) — inner entity id differs from outer contentId, or contentId is missing when required.
Common situations: Wrapped feed responses whose outer id refers to a different item (recommendation reshuffling); cached rows mixed from multiple requests; Nowcoder changing which identifier sits in contentId for moments (uuid vs entity id).
Related errors
- Nowcoder returned mismatched content feed identity
- Bilibili creator comparison returned a malformed manuscript
- Bilibili creator comparison returned duplicate rows for ${bv
- Bilibili view API returned duplicate page entries for p=${pa
- Booking.com hotel row is missing stable name/url identity
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/31c1cb5171178624.
Report an issue: GitHub.