{"record":{"id":"01c5d071b67a58b1","repo":"GraphiteEditor/Graphite","slug":"failed-to-open-app-01c5d0","errorCode":null,"errorMessage":"failed to open app","messagePattern":"failed to open app","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"desktop/bundle/src/win.rs","lineNumber":18,"sourceCode":"use std::error::Error;\nuse std::fs;\nuse std::path::{Path, PathBuf};\n\nuse crate::common::*;\n\nconst EXECUTABLE: &str = \"Graphite.exe\";\n\npub fn main() -> Result<(), Box<dyn Error>> {\n\tlet app_bin = build_bin(\"graphite-desktop-platform-win\", None, None)?;\n\n\tlet executable = bundle(&profile_path(), &app_bin);\n\n\t// TODO: Consider adding more useful cli\n\tlet args: Vec<String> = std::env::args().collect();\n\tif let Some(pos) = args.iter().position(|a| a == \"open\") {\n\t\tlet extra_args: Vec<&str> = args[pos + 1..].iter().map(|s| s.as_str()).collect();\n\t\trun_command(&executable.to_string_lossy(), &extra_args).expect(\"failed to open app\")\n\t}\n\n\tOk(())\n}\n\nfn bundle(out_dir: &Path, app_bin: &Path) -> PathBuf {\n\tlet app_dir = out_dir.join(APP_NAME);\n\n\tclean_dir(&app_dir);\n\n\tcopy_dir(&cef_path(), &app_dir);\n\n\tif let Err(e) = remove_unnecessary_cef_files(&app_dir) {\n\t\teprintln!(\"Failed to remove unnecessary CEF files: {}\", e);\n\t}\n\n\tlet bin_path = app_dir.join(EXECUTABLE);\n\tfs::copy(app_bin, &bin_path).unwrap();","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/GraphiteEditor/Graphite/blob/c507b356453361e31638b8bff8f6d46b6da2961e/desktop/bundle/src/win.rs#L1-L36","documentation":"Panic in the Windows bundler's convenience launcher: after building and copying the Graphite.exe bundle, if invoked with the 'open' CLI subcommand it spawns the bundled executable via run_command. The expect fires when the child process cannot be spawned at all (missing exe, permission denied, OS-level blocking), not when the app itself later crashes.","triggerScenarios":"Graphite.exe is missing from the just-bundled output (CEF runtime copy failed or antivirus quarantined it); the exe path exceeds Windows MAX_PATH limits; SmartScreen/antivirus blocks execution of the unsigned fresh build; execute permission is missing on the exe.","commonSituations":"Windows Defender or SmartScreen quarantining an unsigned freshly built executable; building into deeply nested directories that exceed the 260-character path limit without long-path support enabled; running the bundle from a network share or restricted folder.","solutions":["Verify Graphite.exe actually exists at the bundled path printed by the tool before the spawn","Un-quarantine the exe in Windows Defender / choose 'Run anyway' on SmartScreen, or add a build-output exclusion","Move the build output to a shorter path or enable Windows long-path support (group policy)","Launch Graphite.exe manually from Explorer to see the real OS error (missing DLL, blocked, etc.)"],"exampleFix":"// before\nrun_command(&executable.to_string_lossy(), &extra_args).expect(\"failed to open app\")\n\n// after\nif let Err(e) = run_command(&executable.to_string_lossy(), &extra_args) {\n\teprintln!(\"failed to open app at {}: {e}\", executable.display());\n\tstd::process::exit(1);\n}","handlingStrategy":"try-catch","validationCode":"// Verify the exe exists and is executable before spawning\nlet exe = bundle(&profile_path(), &app_bin).join(EXECUTABLE);\nif !exe.is_file() {\n\teprintln!(\"bundled executable missing at {} (antivirus quarantine?)\", exe.display());\n\tstd::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":"match run_command(&executable.to_string_lossy(), &extra_args) {\n\tOk(()) => {}\n\tErr(e) => {\n\t\teprintln!(\"failed to open app at {}: {e}\", executable.display());\n\t\tstd::process::exit(1);\n\t}\n}","preventionTips":["Add the build output directory to antivirus exclusions or accept the SmartScreen prompt for local builds","Keep bundle output paths short to stay under Windows MAX_PATH","Log the full exe path alongside the spawn error to distinguish missing exe from blocked execution"],"tags":["rust","windows","app-bundling","process-spawn","smartscreen"],"backgroundTag":"process-spawn-failed","analyzedSha":"c507b356453361e31638b8bff8f6d46b6da2961e","analyzedAt":"2026-08-16T21:57:18.596Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}