GraphiteEditor/Graphite · error

Failed to initialize on-disk resource storage

Error message

Failed to initialize on-disk resource storage

What it means

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.

Source

Thrown at desktop/src/app.rs:91

		let exiting = Arc::new(AtomicBool::new(false));

		let rendering_app_event_scheduler = app_event_scheduler.clone();
		let (start_render_sender, start_render_receiver) = std::sync::mpsc::sync_channel(1);
		let exiting_clone = exiting.clone();
		std::thread::spawn(move || {
			let runtime = tokio::runtime::Runtime::new().unwrap();
			loop {
				let result = runtime.block_on(DesktopWrapper::execute_node_graph());
				rendering_app_event_scheduler.schedule(AppEvent::NodeGraphExecutionResult(result));
				let _ = start_render_receiver.recv_timeout(Duration::from_millis(10));
				if exiting_clone.load(Ordering::Relaxed) {
					break;
				}
			}
		});

		let resource_storage = MmapResourceStorage::new(dirs::app_resources_dir()).expect("Failed to initialize on-disk resource storage");

		// Wake the winit event loop when an editor future completes.
		let wake_scheduler = app_event_scheduler.clone();
		let wake = Arc::new(move || {
			wake_scheduler.schedule(AppEvent::DesktopWrapperMessage(DesktopWrapperMessage::Wake));
		});
		let desktop_wrapper = DesktopWrapper::new(rand::rng().random(), Arc::new(resource_storage), dirs::app_autosave_documents_dir(), wgpu_context.clone(), wake);

		Self {
			render_state: None,
			wgpu_context,
			window: None,
			window_scale: 1.,
			window_size: PhysicalSize { width: 0, height: 0 },
			window_maximized: false,
			window_fullscreen: false,
			window_pending_drag: false,
			pointer_position: Default::default(),

View on GitHub (pinned to c507b35645)

Solutions

  1. Check write permission on the app data dir (the parent returned by dirs::data_dir()) and fix ownership/ACLs
  2. Remove any regular file occupying the resources directory path from a previous failed run
  3. Free disk space or raise the user's quota
  4. Run with a writable HOME / XDG_DATA_HOME override to confirm the path itself is the problem

Example fix

// before
let resource_storage = MmapResourceStorage::new(dirs::app_resources_dir()).expect("Failed to initialize on-disk resource storage");

// after
let resource_storage = MmapResourceStorage::new(dirs::app_resources_dir())
	.unwrap_or_else(|e| panic!("Failed to initialize on-disk resource storage at {}: {e}", dirs::app_resources_dir().display()));
Defensive patterns

Strategy: validation

Validate before calling

// Verify the resources dir is creatable/writable before handing it to the storage
let resources_dir = dirs::app_resources_dir();
if std::fs::create_dir_all(&resources_dir).is_err() {
	eprintln!("cannot create resource storage dir at {} (check permissions/disk)", resources_dir.display());
	std::process::exit(1);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of GraphiteEditor/Graphite@c507b35645 (2026-08-16). Data as JSON: /api/errors/1b8b2705e6153b18. Report an issue: GitHub.