Error message explanation attempt to index a spriteud value

My code just crashed on device at a seemlingly random place with the error message:

attempt to index a value
stack traceback:
 [C]: in upvalue `copy`
CoreLibs/sprites.lua:60: in method `copy`

This is traced back to my code with the line local spr = sprWave:copy(). This code is called many many times during the game, and it has never crashed before. This is a really simple loop, but I am not sure what the error message means. Any help would be appreciated.

The code is in the loop:

local sprWave =
    for i=1, #WAVE_COORDS do
            local spr = sprWave:copy()
            spr:addState("run", 1, 4, {yoyo = true, tickStep = 8, animationStartingFrame = math.random(1, 4), reverse = math.random(1, 2) == 1}, true)

For information the Consts.IMG_MAP_WAVES is just an imagetable

Thank you|