ERROR: Inconsistent item format

ERROR: Inconsistent item format

What does this mean?

I’m getting this error in my code node, but I don’t know what it means. Looking at the data arriving at the node, it seems fine to me. What should I be looking for to resolve this?

The incoming data is 2 items. The items each have a json property containing some json data, and a binary file containing a pdf file.

Workflow:

This code node is the first node after an “Execute Workflow Trigger” node.

Output returned by the last node

These are the json items coming from the previous workflow:

[
{
“cm_c”: “36d0fefa-b950-47e1-ab34-ef3a61ae5faf”,
“cm_l”: “523c13a5-2768-464c-aa89-01dc4487edd2”,
“path”: “/36d0fefa-b950-47e1-ab34-ef3a61ae5faf/523c13a5-2768-464c-aa89-01dc4487edd2/Correspondence Others/”,
“filename”: “230727094713 11300 Preliminary Notification of Claim Joe Smith.pdf” },
{
“cm_c”: “36d0fefa-b950-47e1-ab34-ef3a61ae5faf”,
“cm_l”: “523c13a5-2768-464c-aa89-01dc4487edd2”,
“path”: “/36d0fefa-b950-47e1-ab34-ef3a61ae5faf/523c13a5-2768-464c-aa89-01dc4487edd2/Correspondence Others/”,
“filename”: “230727094713 11300 Preliminary Notification of Claim Joanne Smith.pdf”
}
]

There is a pdf with each item as well.

I’m looking at the data and thinking it looks just as it should. I want to delete the binary files as they have already been stored in our file storage in the previous workflow, and I want to ensure that they don’t get used for anything else now, but I do have more to do using the json data in following nodes.

So glad to have someone to ask about this, and grateful for any help or advice,

Thanks, D

Hi @Dan_Ray :wave:

I won’t be able to run your workflow as it requires a lot of external data, but is it possible that the other workflow is not always returning a PDF or a binary file? When you’re looking at your execution data for a failed execution, does it indicate a binary file was there? If they are, are they matching the right binary and MIME type? :thinking:

Hi EH, thanks for your input.
The workflow does always produce a pdf file, if it didn’t then it would fail long before this stage, and the MIME Type is: application/pdf, which is what I think it should be.
Here is the info shown about one of the files as the INPUT to the Remove Binary Code node:

data

File Name:
230810165438 11300 Preliminary Notification of Claim Joe Smith.pdf
File Extension:
pdf
Mime Type:
application/pdf
File Size:
701 kB

Besides the File Name, there are no other differences between these data, and the files themselves are very, very similar as well, being as they are letters to different receipients, saying all the same things.

The input items are being produced in another n8n workflow in which the files are downloaded using an API, and the download is achieved using some of the json data which is already assembled. As far as I can understand it every stage of the building of these items is done in an n8n node that loops over the data, and I can’t think of any way that an incosistency could emerge in the items. Plus, looking at the data, I can’t see any inconsistency between the items.

Naturally, I know I’m almost certainly wrong about something I’ve just written, as that’s how this always works. What types of inconsistency would produce a message like this?

The json is so basic, and none of it is being used in the Remove Binary Code node, so I would think that it doesn’t even make a difference what’s there. The only thing the Remove Binary Code node is doing is deleting each binary file, and so the only part of the input data which it has any interaction with is the binary files, and so my thought would be this:

Is there something about my little javascript code that is really the problem? Is there another way to “drop” the binary data and simply pass the json data forward to the next node?

Thanks again for any clues you might be able to give,

Dan

Hi EH,
Good news! I’ve got this working. It would be nice if you could tell me why this works, because I honestly don’t know.
I’ve altered the javascript to this:

for (const item of $input.all()) {
delete item.binary;
}

return $input.all();

and deleting the whole binary property, rather than the data key within, has got it going again.

Would love your comment,

Many thanks, Dan

2 Likes

Hi @Dan_Ray - I’m honestly not sure here, though I suspect it might have to do with your data structure. This workflow can delete by key just fine :thinking: This also worked with Execute Workflow, much like you’re doing.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.