Code node v2 rejects all returns on n8n Cloud 2.25.7

Hello,

I’m encountering a blocking issue with the Code node on n8n Cloud 2.25.7. Even the simplest return fails with the same error. My setup is n8n Cloud 2.25.7, Code node version 2 (Latest), Run Once for Each Item mode, with Execute Once enabled and On Error set to Continue. Even with just this single line of code: return [{ json: { test: ‘ok’ } }]; I get this error: A ‘json’ property isn’t an object [item 0] at result-validation.ts:37. I’ve tried simplifying the return to a single string value, enabling Execute Once, changing On Error to Continue, adding an Edit Fields node before the Code node to clean up the input item, and testing with return [{ json: { skipped: ‘true’ } }] — same error every time. The input comes from an Edit Fields node with only these fields: id (string), threadId (string), kDriveFileName (null), mimeType (null), attachmentKey (null), skipAttachment (boolean true). The item has no binary data attached. Is there a known bug with Code node v2 on Cloud 2.25.7 that rejects all returns when the input item contains null values? Is there a workaround? Thank you in advance.

The issue is likely with the Code node’s mode, not the null values. In Run Once for Each Item mode, n8n expects a single item as output, so try without an array: return { json: { test: 'ok' } };

Keep return [{ json: ... }] only if the node is in Run Once for All Items mode. If the error persists with these two separate modes, the useful detail to post next is a screenshot of the Code node’s Mode / Execute Once setting, because this combination can make it seem like the node expects the wrong output format.

Welcome @TO1!

The root cause here is the null values in your input - mimeType: null, attachmentKey: null, kDriveFileName: null. The Code node v2 runs stricter validation and can reject items where null values are present in certain positions. Try stripping them before returning:

const clean = Object.fromEntries(
  Object.entries($input.item.json).filter(([_, v]) => v !== null)
);
return { json: { ...clean } };

This should resolve the A 'json' property isn't an object error regardless of the mode. You provided really clear reproduction steps, so if this doesn’t fix it, share the exact node mode screenshot and we can dig further.