I encountered this error when running the soffice commandline interface under Jammy Jellyfish (Ubuntu 22.04). Since there wasn't any window being generated I was puzzled. A little searching revealed that the library libgdk3.0-cil (CLI binding for GDK 3) was not installed, and so running:
sudo apt install libgdk3.0-cil
solved the problem.