Flexgrid optical networking technology allows for a more flexible consumption of bandwidth. The spectrum allocation problem consists of the conflict‐free assignment of consecutive spectrum space of different sizes to lightpaths. In this article, we study the computational complexity of spectrum allocation with and without demand uncertainty. First, it is shown that the problem becomes already NP‐hard for cases where wavelength assignment is still polynomial time solvable. Next, five different ways to define the robust counterpart are compared. It is shown (amongst others) that on a single network edge, the two least efficient models are less computationally demanding than the other variants. A computational study using comparable integer linear programming formulations reveals that the additional slots required by these models directly depend on the restrictions of the employed technology. © 2017 Wiley Periodicals, Inc. NETWORKS, Vol. 70(4), 342–359 2017