This can be common. An assumption is that tabs are for new sketches. But they only open another file for some more code; for the same sketch. Meaning you only declare void setup() and void loop() once.
So you may have declared this more than once leading to this error.