In my case i forgot to import
implementation(libs.androidx.ui.tooling)
and only had the tooling preview imported:
implementation(libs.androidx.ui.tooling.preview)