{"record":{"id":"1b8b2705e6153b18","repo":"GraphiteEditor/Graphite","slug":"failed-to-initialize-on-disk-resource-storage","errorCode":null,"errorMessage":"Failed to initialize on-disk resource storage","messagePattern":"Failed to initialize on-disk resource storage","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"desktop/src/app.rs","lineNumber":91,"sourceCode":"\n\t\tlet exiting = Arc::new(AtomicBool::new(false));\n\n\t\tlet rendering_app_event_scheduler = app_event_scheduler.clone();\n\t\tlet (start_render_sender, start_render_receiver) = std::sync::mpsc::sync_channel(1);\n\t\tlet exiting_clone = exiting.clone();\n\t\tstd::thread::spawn(move || {\n\t\t\tlet runtime = tokio::runtime::Runtime::new().unwrap();\n\t\t\tloop {\n\t\t\t\tlet result = runtime.block_on(DesktopWrapper::execute_node_graph());\n\t\t\t\trendering_app_event_scheduler.schedule(AppEvent::NodeGraphExecutionResult(result));\n\t\t\t\tlet _ = start_render_receiver.recv_timeout(Duration::from_millis(10));\n\t\t\t\tif exiting_clone.load(Ordering::Relaxed) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tlet resource_storage = MmapResourceStorage::new(dirs::app_resources_dir()).expect(\"Failed to initialize on-disk resource storage\");\n\n\t\t// Wake the winit event loop when an editor future completes.\n\t\tlet wake_scheduler = app_event_scheduler.clone();\n\t\tlet wake = Arc::new(move || {\n\t\t\twake_scheduler.schedule(AppEvent::DesktopWrapperMessage(DesktopWrapperMessage::Wake));\n\t\t});\n\t\tlet desktop_wrapper = DesktopWrapper::new(rand::rng().random(), Arc::new(resource_storage), dirs::app_autosave_documents_dir(), wgpu_context.clone(), wake);\n\n\t\tSelf {\n\t\t\trender_state: None,\n\t\t\twgpu_context,\n\t\t\twindow: None,\n\t\t\twindow_scale: 1.,\n\t\t\twindow_size: PhysicalSize { width: 0, height: 0 },\n\t\t\twindow_maximized: false,\n\t\t\twindow_fullscreen: false,\n\t\t\twindow_pending_drag: false,\n\t\t\tpointer_position: Default::default(),","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/GraphiteEditor/Graphite/blob/c507b356453361e31638b8bff8f6d46b6da2961e/desktop/src/app.rs#L73-L109","documentation":"Panic when MmapResourceStorage::new fails. Internally it only calls fs::create_dir_all on the app resources directory (under the OS data dir, e.g. ~/Library/Application Support/<app> or %APPDATA%/<app>) and returns the io::Error unchanged. So this panic means the on-disk resource cache directory could not be created: permission denied, a file existing where the directory should go, a full disk, or an invalid path.","triggerScenarios":"First launch on a machine where the user has no write access to the OS data directory (corporate lockdown, roaming profiles); a previous crash leaving a regular file at the resources directory path; disk quota exhausted; HOME/data dir environment pointing to a nonexistent read-only location.","commonSituations":"Running the app in a container or sandbox without a writable home; corporate policy restricting Application Support/AppData writes; running as a different user than the one who owns the data directory.","solutions":["Check write permission on the app data dir (the parent returned by dirs::data_dir()) and fix ownership/ACLs","Remove any regular file occupying the resources directory path from a previous failed run","Free disk space or raise the user's quota","Run with a writable HOME / XDG_DATA_HOME override to confirm the path itself is the problem"],"exampleFix":"// before\nlet resource_storage = MmapResourceStorage::new(dirs::app_resources_dir()).expect(\"Failed to initialize on-disk resource storage\");\n\n// after\nlet resource_storage = MmapResourceStorage::new(dirs::app_resources_dir())\n\t.unwrap_or_else(|e| panic!(\"Failed to initialize on-disk resource storage at {}: {e}\", dirs::app_resources_dir().display()));","handlingStrategy":"validation","validationCode":"// Verify the resources dir is creatable/writable before handing it to the storage\nlet resources_dir = dirs::app_resources_dir();\nif std::fs::create_dir_all(&resources_dir).is_err() {\n\teprintln!(\"cannot create resource storage dir at {} (check permissions/disk)\", resources_dir.display());\n\tstd::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the user has write access to the OS data directory on first launch and surface a clear message","Remove regular files that squat on the app data directory path after failed runs","Include the directory path and io::Error in any panic message to make support triage direct"],"tags":["rust","filesystem","resource-storage","mmap","app-initialization"],"backgroundTag":"permission-denied-creating-directory","analyzedSha":"c507b356453361e31638b8bff8f6d46b6da2961e","analyzedAt":"2026-08-16T21:57:18.596Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}