Java process cannot run `daml` even if it's in path

I’m building the daml-app-template project with gradle. Daml is installed just fine, as daml version works.
But running ./gradlew :app:daml:assemble, I get

ERROR: Daml assistant is not installed.
            Please follow the instructions in DEVELOPER-INSTALLATION.md and ensure that a suitable version of daml
            assistant is installed.

Digging deeper, the exception in the gradle build plugin is:

Cannot run program "daml" (in directory "/Users/bame/repo/daml-app-template/app/daml/build"): error=2, No such file or directory

Any ideas what might be causing Java not to be able ot pick up on the binary that’s in PATH?

In the end a reboot helped. This was MacOS 14.6.