Reproduced on Git 2.50.1: git status in a folder with no repository above it printed fatal: not a git repository (or any of the parent directories): .git and exited 128. So did a copy of a repository exported with git archive, which contains the files and no .git, the same situation as a Docker build whose context leaves .git out.
With GIT_DIR pointing at a missing directory, the message names that path instead: fatal: not a git repository: '/nonexistent'.
A worktree whose main repository had been moved failed with the old path, because its .git file still pointed there. git worktree repair, run in the moved repository with the worktree's path, fixed it.
Git stops searching at a filesystem boundary unless GIT_DISCOVERY_ACROSS_FILESYSTEM is set; its source then says not a git repository (or any parent up to mount point …) and Stopping at filesystem boundary. Reproduced on Git 2.50.1 by mounting a small disk image inside a repository: git status inside the mount printed fatal: not a git repository (or any parent up to mount point …) and Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)., exit 128. The path it names is where the search stopped, the repository directory just above the mount. With GIT_DISCOVERY_ACROSS_FILESYSTEM=1 the same command found the repository.