Impure Nix shell fails with `error: _assignFirst: could not find a non-empty variable whose name to assign to outputDev`

Hi there, I want to start an impure Nix shell. Whenever I start it, e.g. by nix-shell -p hello, I get the following error message:

this path will be fetched (0.02 MiB download, 0.07 MiB unpacked):
  /nix/store/l56c62qg4qsc5jqr0bj75zkckw13hzfr-hello-2.12.1
copying path '/nix/store/l56c62qg4qsc5jqr0bj75zkckw13hzfr-hello-2.12.1' from 'https://cache.nixos.org'...

error: _assignFirst: could not find a non-empty variable whose name to assign to outputDev.
       The following variables were all unset or empty:
           dev out
       If you do not want an "out" output in your derivation, make sure to define
       the other specific required outputs. This can be achieved by picking one
       of the above as an output.
       You do not have to remove "out" if you want to have a different default
       output, because the first output is taken as a default.

bash: pop_var_context: head of shell_variables not a function context
bash: pop_var_context: head of shell_variables not a function context

How do I fix this error?

System: macOS Ventura 13.3.1
Nix version: 2.12.0