I have been facing the following error, which I believe is thrown some of the time when my rust code is to built. (I have been able to run my Rust tests, but for some reason have been unable to run cargo check, and cargo check fails when my IDE runs it on startup.)
I am also getting this error when running tauri-dev / tauri-build. (sometimes am able to run tauri-dev, but never tauri-build)
This is the error message I receive when running any command (npm run tauri-dev/tauri build, cargo check/build)
error: failed to determine package fingerprint for build script for app v0.1.0 (C:{project path}src-tauri)
An I/O error happened. Please make sure you can access the file.
By default, if your project contains a build script, cargo scans all files in
it to determine whether a rebuild is needed. If you don't expect to access the
file, specify `rerun-if-changed` in your build script.
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-changed for more information.
Caused by:
failed to determine the most recently modified file in C:{project path}src-tauri
Caused by:
failed to determine list of files in C:{project path}src-tauri
Caused by:
Could not read repository exclude
Caused by:
The filename, directory name, or volume label syntax is incorrect. (os error 123)
Versions for anything that could matter:
- Node.js version: 21.5.0
- NPM version: 10.2.4
- git version: 2.46.0.windows.1
- rustup: 1.27.1
- rustc: 1.81.0
- tauri-build: 1.5.3
- tauri-apps/cli: 1.6.0
- tauri-apps/api: 1
I would be happy to provide any other logs, although none have been notable, for instance my NPM logs are completely standard.
An important thing to note is that the actual code in this project does not matter. It will not build regardless of the content (as long as I have the basic tauri main, & build script, along with boilerplate tauri frontend) and the file structure is the same. Additionally, if I copy the project out of its original directory to another, with no changes to the code itself, everything is able to be ran as normal.
The final observation I have made before coming to Stack Overflow, is that I am able to “fix” this error by deleting any of the integral .git files (HEAD/INDEX/..etc). This lasts only as long as I don’t commit my changes, and breaks the moment I link back to remote, create a new repository or pull/push. (Presumably because it “fixes” my .git directory)
I AM able to continue working on this project, although having to fix my .git directory every time will be more than a slight annoyance, and I would prefer to continue using GitHub. (Please don’t recommend using other repository solutions, thanks!)
I have solved my own problem – it was a problem specific to my own git setup, although I will post the answer here just in case anyone else has this problem;
As I had thought, the problem I was facing was an issue with my git configuration, which stuck around even when I uninstalled and reinstalled.
I had tried to set up a wildcard git ignore for .env files, which created an impossible match for regex.
I added this in my %USERPROFILE%.gitconfig core.excludesFile section with this command:
git config --global core.excludesFile "%USERPROFILE%.gitignore"
I noticed this when reinstalling the repository, as it was complaining about the impossible match.
Presumably the reason my project is building without a proper .git is that It does not link back to %USERPROFILE%.gitignore , and thus has no link to the impossible match. Regardless, deleting the problematic line has fixed this problem.
If you’re in my position and have not set global variables, I could recommend deleting everything in your own .gitignore folder, as I noted when running tauri dev –verbose, it will parse each expression when building your project.