Boolean Modifier's "Union" operation causes inner geometry?

I wrote a script that generates a number of cubes right next to each other (touching plane to plane) and I’d like to combine these cubes with the Boolean Modifier. However, when I collapse the whole thing, I get random inner planes.

The cubes all have the same size and a fixed position so I cannot explain why there is inner geometry. Is it because the values are floats? Is it a problem with the Boolean Modifier? :confused:

The order of combination doesn’t make a difference. And neither does collapsing the objects one by one. I tried.

Can somebody help me out?