Cuda OpenGL interoperability error 999

When trying to run the oceanFFT example I get the following error

./oceanFFT 
NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.

[CUDA FFT Ocean Simulation]

Left mouse button          - rotate
Middle mouse button        - pan
Right mouse button         - zoom
'w' key                    - toggle wireframe
[CUDA FFT Ocean Simulation] 
GPU Device 0: "Ampere" with compute capability 8.6

CUDA error at oceanFFT.cpp:304 code=999(cudaErrorUnknown) "cudaGraphicsGLRegisterBuffer(&cuda_heightVB_resource, heightVertexBuffer, cudaGraphicsMapFlagsWriteDiscard)" 

What could be the reasons for this?

Thanks!