Modulo by zero error in operator '%'

Godot Version

I was just following a tutorial for a voxel engine untill i got an error whenever i ran the script i got "Modulo by zero error in operator’%'. "

Here is the code for the variables:

@export var colors: Array[Color]

var data: Dictionary[Vector3, Color] = {}

And here is where the error is:

data[Vector3(x, y, z)] = colors[y % colors.size()]

Any help appreciated.

Don’t divide by zero. Put some colors into colors array so its size is not zero.

Thank you very much