I had the same error on a dynamically created table. Depending on the input, some rows were displayed or not. Like this:
Causes no error:
<table>
<tr>
<td> cell 1 in row 1 </td>
<td> cell 2 in row 1 </td>
</tr>
<tr>
<td colspan=2> one cell in row 2 </td>
</tr>
</table>
Causes no error:
<table>
<tr>
<td> cell 1 in row 1 </td>
<td> cell 2 in row 1 </td>
</tr>
</table>
Causes an error:
<table>
<tr>
<td colspan=2> one cell in row 2 </td>
</tr>
</table>
Once I programmed the page to delete the colspan from the last example when the first row was not displayed, the error disappeared. Something like this:
<?php if (first row with two cells is displayed) echo 'colspan=2'; ?>
I find this logical. colspan=2 with only single cells is like telling someone visiting me to turn right on a street that does not have any junctions, believing that they will continue straight on. They won't. Instead they will get hung up searching for something that is not there. Maybe not a completely accurate analogy, but you can imagine a dumb browser creating display errors while looking for stuff that you tell it is there, but is not. Browsers shouldn't be expected to "think" that maybe you meant your code differently from how you wrote it.