{"record":{"id":"0836ca5ab49ba493","repo":"tauri-apps/tauri","slug":"startingbinary-found-current-exe-that-contains-a-symlink-on","errorCode":null,"errorMessage":"StartingBinary found current_exe() that contains a symlink on a non-allowed platform: {}","messagePattern":"StartingBinary found current_exe\\(\\) that contains a symlink on a non-allowed platform: (.+?)","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-utils/src/platform/starting_binary.rs","lineNumber":31,"sourceCode":"  #[ctor(unsafe)]\n  pub(super) static STARTING_BINARY: StartingBinary = unsafe { StartingBinary::new() };\n}\n\n/// Represents a binary path that was cached when the program was loaded.\npub(super) struct StartingBinary(std::io::Result<PathBuf>);\n\nimpl StartingBinary {\n  /// Find the starting executable as safely as possible.\n  fn new() -> Self {\n    // see notes on current_exe() for security implications\n    let dangerous_path = match std::env::current_exe() {\n      Ok(dangerous_path) => dangerous_path,\n      error @ Err(_) => return Self(error),\n    };\n\n    // note: this only checks symlinks on problematic platforms, see implementation below\n    if let Some(symlink) = Self::has_symlink(&dangerous_path) {\n      return Self(Err(Error::new(\n        ErrorKind::InvalidData,\n        format!(\n          \"StartingBinary found current_exe() that contains a symlink on a non-allowed platform: {}\",\n          symlink.display()\n        ),\n      )));\n    }\n\n    // we canonicalize the path to resolve any symlinks to the real exe path\n    Self(dangerous_path.canonicalize())\n  }\n\n  /// A clone of the [`PathBuf`] found to be the starting path.\n  ///\n  /// Because [`Error`] is not clone-able, it is recreated instead.\n  pub(super) fn cloned(&self) -> Result<PathBuf> {\n    // false positive\n    #[allow(clippy::useless_asref)]","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-utils/src/platform/starting_binary.rs#L13-L49","documentation":"On platforms where resolving the current executable through a symlink is considered unsafe, StartingBinary::new() resolves current_exe() and checks the resulting path for symlinks. If a symlink component is found, it returns an io::Error (InvalidData) naming the path, because the resolved binary may not be the intended Tauri app binary.","triggerScenarios":"Launching a Tauri app via a symlinked binary path on a platform not in the allowed list (e.g. running the app binary through a symlink created for version switching), then invoking functionality that resolves the starting binary.","commonSituations":"Package managers or wrappers that symlink the executable; Nix-style store links; developers testing the app through a symlink in ~/bin.","solutions":["Launch the real binary instead of a symlink to it","Remove or restructure the symlink so the executable path is direct","If the symlink is required, check the platform-allowlist in starting_binary.rs and update Tauri or file an issue for that platform","Copy (rather than link) the binary where it will be launched from"],"exampleFix":"// before\nln -s /opt/myapp/myapp ~/bin/myapp && ~/bin/myapp\n// after\n~/opt/myapp/myapp   # invoke the real binary directly","handlingStrategy":"validation","validationCode":"// Resolve and check before launching\nimport fs from 'fs';\nimport path from 'path';\nconst exe = process.execPath; // or resolved install path\nif (fs.lstatSync(exe).isSymbolicLink()) {\n  console.warn('launching via symlink may fail on this platform:', fs.realpathSync(exe));\n}","typeGuard":null,"tryCatchPattern":"// Rust: wrap operations relying on the resolved binary in Result handling\nmatch app.path().resolve(...) { Ok(p) => ..., Err(e) => log::error!(\"starting binary resolution failed: {e}\") }","preventionTips":["Install binaries as real files, not symlinks, on non-allowed platforms","Test app launches from the actual install location in packaging CI","Document for users not to symlink the executable"],"tags":["filesystem","symlink","security","platform"],"backgroundTag":"unsupported-platform","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}