.claude/skills/tauri-2/tauri-errors/tauri-errors-build/SKILL.md
Use when encountering Tauri 2 build errors, bundler failures, or platform-specific compilation issues. Prevents chasing phantom failures from stale build artifacts and misidentifying the failing build pipeline phase. Covers Cargo compilation failures, bundler errors, code signing failures, Linux dependencies, mobile builds, and CI/CD failures. Keywords: tauri build error, cargo compile, bundler error, code signing, linker error, NSIS, WiX, CI/CD failure.
npx skillsauth add OpenAEC-Foundation/OpenAEC-Workspace-Composer tauri-errors-buildInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
When a Tauri 2 build fails, identify the phase first:
Build Pipeline Phases:
1. Frontend build (beforeBuildCommand) --> JS/TS errors
2. Cargo compile (rustc) --> Rust compilation errors
3. Bundler (NSIS/WiX/DMG/deb) --> Platform packaging errors
4. Code signing (codesign/signtool) --> Signing/notarization errors
ALWAYS read the FULL error output. The root cause is often buried above the final error message.
NEVER skip cargo clean when troubleshooting persistent compilation errors -- stale build artifacts cause phantom failures.
Error: error[E0255]: the name X is defined multiple times or cryptic macro expansion errors.
Cause: Command functions defined directly in src-tauri/src/lib.rs are marked pub.
Fix: ALWAYS remove pub from command functions in lib.rs. Commands in separate modules MUST be pub.
// WRONG -- in lib.rs
#[tauri::command]
pub fn greet(name: String) -> String { ... }
// CORRECT -- in lib.rs
#[tauri::command]
fn greet(name: String) -> String { ... }
// CORRECT -- in src-tauri/src/commands.rs (separate module)
#[tauri::command]
pub fn greet(name: String) -> String { ... }
Error: the trait bound MyError: Serialize is not satisfied
Cause: Command return type Result<T, E> requires E to implement serde::Serialize.
Fix: ALWAYS implement Serialize manually for error enums that use thiserror:
#[derive(Debug, thiserror::Error)]
enum AppError {
#[error(transparent)]
Io(#[from] std::io::Error),
#[error("not found: {0}")]
NotFound(String),
}
impl serde::Serialize for AppError {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: serde::ser::Serializer {
serializer.serialize_str(self.to_string().as_ref())
}
}
Error: implementation of FnOnce is not general enough or lifetime errors in async command signatures.
Cause: Async commands cannot use &str directly due to spawning on the tokio runtime.
Fix: Use owned types (String) or wrap return in Result:
// WRONG
#[tauri::command]
async fn process(value: &str) -> String { value.to_uppercase() }
// CORRECT -- option 1: owned type
#[tauri::command]
async fn process(value: String) -> String { value.to_uppercase() }
// CORRECT -- option 2: wrap in Result
#[tauri::command]
async fn process(value: &str) -> Result<String, ()> { Ok(value.to_uppercase()) }
Error: Commands silently not working -- no compilation error.
Cause: Only the LAST .invoke_handler() call on Builder takes effect. Multiple calls do NOT merge.
Fix: ALWAYS use a single generate_handler![] with all commands:
// WRONG -- only cmd2 works
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![cmd1])
.invoke_handler(tauri::generate_handler![cmd2])
// CORRECT
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![cmd1, cmd2])
Error: cannot produce cdylib for app_lib or linking errors on tauri android build / tauri ios build.
Cause: Cargo.toml missing required crate types for mobile targets.
Fix: ALWAYS include all three crate types when targeting mobile:
[lib]
name = "app_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
Error: App crashes immediately on mobile, or tauri android build / tauri ios build fails with missing symbol errors.
Cause: Missing #[cfg_attr(mobile, tauri::mobile_entry_point)] macro or incorrect project structure.
Fix: ALWAYS split into lib.rs + main.rs for mobile support:
// src-tauri/src/lib.rs
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
// src-tauri/src/main.rs
fn main() {
app_lib::run();
}
Error: Package webkit2gtk-4.1 was not found or error: could not find system library 'webkit2gtk-4.1'
Fix: Install required system dependencies:
# Ubuntu/Debian
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf
# Fedora
sudo dnf install webkit2gtk4.1-devel libappindicator-gtk3-devel librsvg2-devel
# Arch
sudo pacman -S webkit2gtk-4.1 libappindicator-gtk3 librsvg
NEVER install libwebkit2gtk-4.0-dev -- Tauri 2 requires the 4.1 variant.
Error: linker cc not found or failed to run custom build command
Fix: Install base build tools:
sudo apt-get install -y build-essential curl wget file libssl-dev libgtk-3-dev \
libayatana-appindicator3-dev
Error: NSIS Error or MakeNSIS exited with error
Common causes and fixes:
productName or move project closer to drive rootchoco install nsis or winget install NSIS.NSIS.ico files with specific sizesError: candle.exe exited with error or light.exe exited with error
Fix: Install WiX Toolset v3: dotnet tool install --global wix
Error: hdiutil: create failed or DMG size errors
Common causes: Disk space insufficient, or icon file path incorrect in tauri.conf.json.
Error: AppImage bundling failed or missing appimagetool
Fix: Ensure FUSE is available. On Ubuntu 22.04+:
sudo apt-get install -y libfuse2
Error: Failed to download WebView2 bootstrapper
Fix: Configure offline installation in tauri.conf.json:
{
"bundle": {
"windows": {
"webviewInstallMode": "offlineInstaller"
}
}
}
Error: "MyApp" is damaged and can't be opened or Gatekeeper rejection.
Fix: At minimum use ad-hoc signing for testing:
{
"bundle": {
"macOS": {
"signingIdentity": "-"
}
}
}
For distribution, ALWAYS use a proper Developer ID certificate.
Error: The signature of the binary is invalid or notarytool errors.
Checklist:
"hardenedRuntime": true"Developer ID Application: Name (TEAMID)"APPLE_API_ISSUER, APPLE_API_KEY, APPLE_API_KEY_PATHError: SignTool Error or certificate thumbprint not found
Checklist:
"certificateThumbprint": "A1B2...""timestampUrl": "http://timestamp.comodoca.com"Error: Various dependency errors in CI.
Fix: ALWAYS include the Linux dependency installation step:
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev
Error: Resource not accessible by integration or 403 on release creation.
Fix: Set permissions in workflow:
permissions:
contents: write
And ensure repository Settings > Actions > General > Workflow permissions is set to "Read and write."
Error: TAURI_SIGNING_PRIVATE_KEY must be set
Cause: "createUpdaterArtifacts": true in config but no signing key.
Fix: Either set the environment variable in CI secrets, or set "createUpdaterArtifacts": false if not using auto-updater.
Error: error[E0463]: can't find crate for std when building for a different architecture.
Fix: Install the target toolchain:
# macOS universal binary
rustup target add aarch64-apple-darwin x86_64-apple-darwin
# Android
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
# iOS
rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim
Build failed?
|
+-- Is it a Rust compilation error?
| +-- Type mismatch in command? --> Check ERR-B001, ERR-B002, ERR-B003
| +-- Symbol/linking error? --> Check ERR-B005, ERR-B006, ERR-B043
| +-- Commands not found at runtime? --> Check ERR-B004
|
+-- Is it a system dependency error?
| +-- Linux? --> Check ERR-B010, ERR-B011
| +-- Windows WebView2? --> Check ERR-B024
|
+-- Is it a bundler error?
| +-- Windows NSIS/WiX? --> Check ERR-B020, ERR-B021
| +-- macOS DMG? --> Check ERR-B022
| +-- Linux AppImage? --> Check ERR-B023
|
+-- Is it a code signing error?
| +-- macOS? --> Check ERR-B030, ERR-B031
| +-- Windows? --> Check ERR-B032
|
+-- Is it a CI/CD error?
+-- Linux deps? --> Check ERR-B040
+-- Permissions? --> Check ERR-B041
+-- Updater keys? --> Check ERR-B042
+-- Cross-compile? --> Check ERR-B043
cargo clean in src-tauri/ before retryingtauri info output for environment diagnosticstauri.conf.json has valid JSON (use schema validation)development
Use when integrating Vite with a backend framework, rendering Vite assets from server-side templates, or setting up dev/production HTML serving. Prevents incorrect manifest.json traversal and missing CSS chunk resolution in production. Covers build.manifest configuration, .vite/manifest.json structure, ManifestChunk properties, dev mode HTML setup, production rendering, CSS/JS chunk resolution, and modulepreload polyfill. Keywords: backend integration, manifest.json, ManifestChunk, Django, Laravel, Rails, modulepreload.
development
Use when encountering dev server startup failures, HMR issues, proxy errors, CORS blocks, or module not found errors during development. Prevents misconfiguring server.hmr behind reverse proxies and forgetting appType: 'custom' in middleware mode. Covers HMR full-reload debugging, proxy configuration, CORS setup, HTTPS certificates, server.fs.strict violations, port conflicts, WebSocket failures, file watcher issues, and middleware mode. Keywords: dev server, HMR, proxy, CORS, HTTPS, WebSocket, port conflict, server.fs.strict, middleware mode, file watcher.
development
Use when encountering pre-bundling errors, dependency resolution failures, stale cache issues, or slow development server startup. Prevents excluding CJS dependencies from pre-bundling (which breaks runtime module resolution) and misconfiguring optimizeDeps. Covers CJS/ESM conversion failures, missing dependency auto-discovery, optimizeDeps configuration, monorepo linked dependencies, cache invalidation, browser cache staleness, and large dependency tree performance. Keywords: pre-bundling, optimizeDeps, CJS, ESM, cache, dependency resolution, monorepo, node_modules/.vite.
development
Use when encountering Vite build failures, chunk size warnings, or version-specific build errors. Prevents the common mistake of using deprecated rollupOptions in v8 or misconfiguring build targets and minifiers. Covers Rolldown/Rollup bundling failures, CSS minification errors, sourcemap problems, library mode build failures, BundleError handling, and asset processing errors. Keywords: build error, Rolldown, chunk size, sourcemap, library mode, minify, BundleError, rollupOptions, build.target.