Execute failed: Cell count in row "Row0" is not equal to length of column names array: 4 vs. 5

Hi Guys,

Good day.
I am currently looping an Array List of Strings. However, I encountered this problem “Execute failed: Cell count in row “Row0” is not equal to length of column names array: 4 vs. 5”. Does anyone encounters this kind of problem?

Thank you in advance!

Best regards,
Gambit

Hello @Gambit,

Could you please share you workflow or some input to be able to help you ?

Br,
Samir

1 Like

Hi @SamirAbida,

Good day.
Thank you for your reply. Currently, I am doing java programming. And based on the error ay encountered, the error is in the data container.

Thank you and best regards,
Gambit

1 Like

Hi @Gambit,

Are you trying to create a row when this error happens? It looks to me that your new row is not matching the column spec. If you add five columns to the spec, then you also need to add 5 cells to each row.

best,
Gabriel

1 Like

Hi @gab1one ,

Good day.
Yes, I am currently creating new rows.
This is my input.
image

And this is my output when I selected “Tag 1” to be manipulated.
image

But when I selected more than 1 column, I am having an error. My desired output if I select “Tag1” and “Tag2” should be like this:

Currenly, on my error it says that I am having a problem with my container. So far, every variables that I checked shows the correct number of columns and it’s names.
Any advice would be very helpful.
Thank you in advance.

Best regards,
Gambit

Hi @Gambit,

How do you create the data container?
Probably like this:

exec.createDataContainer(spec);

If you want to add more columns to your output table, you need to adapt the spec first.

best,
Gabriel

2 Likes

Hi @gab1one ,

Good day.
Yes, I did that. Can you show me some ways how to do it?

Thank you in advance.

Best regards,
Gambit

Hi @gab1one ,

Good day.
When I try to debugging it, it seems that my table spec is correct and it shows the expected number of columns and it’s column names. I just wonder why I am having an error on the column names array.

Thank you and have a nice day.

Best regards,
Gambit

Hi @Gambit,

As you can see in the code, this error is thrown if the number of cells in a row does not match the number of columns defined in the spec:
https://bitbucket.org/KNIME/knime-core/src/7f494d3b4fde42239f5010bab4c8f42b9e12f102/org.knime.core/src/eclipse/org/knime/core/data/def/DefaultTable.java?at=master#lines-117

Have you tried setting a breakpoint on the IllegalArgumentException? This should allow you to inspect the exact line that causes the problem:
image

best,
Gabriel

2 Likes

Hi @gab1one ,

Good day.
Not yet, my breakpoints are only on the other argument, but I will try this. With regards to the link you gave, where can I use the DefaultTable?

Thank you in advance!

Best regards,
Gambit