I ran into this while working on a Keyboard Maestro macro that creates hard links: The macOS version of cp won't create links, at least not in Sonoma. In Ventura, it works even though it throws the same error as it does in Sonoma.
Copying as hard links is part of the cp feature set, fully covered in its man pages. But it doesn't work in macOS. To confirm, try this:
$ mkdir temp
$ cd temp
$ touch testfile
$ cp -al testfile linkfile
cp: linkfile: Bad file descriptor
$ ls -il
90783664 -rw-r--r-- 1 robg staff 0 Oct 10 08:41 testfile
$ ln testfile linkfile
$ ls -il
90783664 -rw-r--r-- 2 robg staff 0 Oct 10 08:41 linkfile
90783664 -rw-r--r-- 2 robg staff 0 Oct 10 08:41 testfile
I have filed this bug as FB13255408 with Apple, and I'm hopeful they fix it soon. There is a workaround, obviously: Use ln instead. This works fine for individual hard links, but using cp to quickly copy an entire folder as hard links is a nicer implementation.