Bug error message in deploy with private submodule

I am receiving a fatal error while trying to deploy a site with a private submodule hosted on GitHub. I followed this setup guide to configure the submodule, and can successfully build the site using the Netlify CLI netlify build command locally.

I have read this support thread, but have not come across any error message like the one I see in my build logs, either there or elsewhere on the web. Thanks for your time, I normally would assume it is a configuration error on my part but these lines in particular from the build logs made me think something about the build environment is going sideways:

fatal: not a git repository: /opt/build/repo/vault/../.git/modules/vault
Failed to clone 'vault'. Retry scheduled
BUG: submodule considered for cloning, doesn't need cloning any more?

The “BUG” message caught my eye, and I’m not sure what the sentence after it means.

For context, I have a folder structure like so:

|____tailwind.config.js
|____netlify.toml
|____contentlayer.config.ts
|____next.config.mjs
|____node_modules
| |____(all my node modules)
...
|____tsconfig.json
|____.git
| |____ORIG_HEAD
| |____config
| |____(More Git Config)
| |____index
| |____modules
| | |____vault
| | | |____(vault submodule Git Directory)
| |____COMMIT_EDITMSG
| |____FETCH_HEAD
| |____config.worktree
|____pages
| |____(My NextJS website's pages)
|____.eslintrc.json
|____vault
| |____public
| | |____(All my public notes)
| |____.gitignore
| |____private
| | |____(All my private notes)
| |____.github
| | |____workflows
| | | |____main.yml
| |____.git

The .git file within my vault/ directory simply contains gitdir: ../.git/modules/vault, which looks like it may be related to what’s throwing the Netlify build environment for a loop, since my error message contained fatal: not a git repository: /opt/build/repo/vault/../.git/modules/vault. But that file was created for me when I added the submodule, and it is a valid Git repository.

Netlify Site

https://obsidian-nextjs-blog.netlify.app/

Build Logs

7:28:14 PM: Build ready to start
7:28:16 PM: build-image version: a49edbc55fc722f80f6b85963a5060f8d043a844 (focal)
7:28:16 PM: build-image tag: v4.8.1
7:28:16 PM: buildbot version: f89dd42aa70d76d1da992dc3fa004a4c745208bc
7:28:16 PM: Fetching cached dependencies
7:28:22 PM: Finished downloading cache in 5.378814421s
7:28:22 PM: Starting to extract cache
7:28:40 PM: Finished extracting cache in 17.864449599s
7:28:40 PM: Finished fetching cache in 23.337979067s
7:28:40 PM: Starting to prepare the repo for build
7:28:40 PM: Preparing Git Reference refs/heads/main
7:28:41 PM: Error checking out submodules: Submodule 'vault' (https://github.com/franknoirot/personal-notes) registered for path 'vault'
  fatal: not a git repository: /opt/build/repo/vault/../.git/modules/vault
  Failed to clone 'vault'. Retry scheduled
  BUG: submodule considered for cloning, doesn't need cloning any more?
  fatal: could not get a repository handle for submodule 'vault'
7:28:41 PM: Creating deploy upload records
7:28:41 PM: Failing build: Failed to prepare repo
7:28:41 PM: Failed during stage 'preparing repo': Error checking out submodules: Submodule 'vault' 
  (https://github.com/franknoirot/personal-notes) registered for path 'vault'
  fatal: not a git repository: /opt/build/repo/vault/../.git/modules/vault
  Failed to clone 'vault'. Retry scheduled
  BUG: submodule considered for cloning, doesn't need cloning any more?
  fatal: could not get a repository handle for submodule 'vault': exit status 128
7:28:41 PM: Finished processing build request in 24.897904243s

Hi @franknoirot,

Does the error occur when using Clear cache and deploy?