If the planet has any ships or defenses queued for construction, the Shipyard cannot be upgraded. Same for Research Lab with a research in progress.
So it's not a gameplay bug, but I think the error message was not clear enough. I clarified it a bit, thanks for bringing this up.