GraphiteEditor/Graphite · error

failed to create app resource dir

Error message

failed to create app resource dir

What it means

Panic in Graphite's macOS .app bundler when fs::create_dir_all fails to create the Contents/Resources directory inside the generated Graphite.app bundle. create_dir_all walks every path component, so it fails if any component is an existing regular file, if the target volume/dir is read-only or lacks write permission, or if the disk is full. Because the tool uses .expect, any io::Error aborts bundle generation immediately.

Source

Thrown at desktop/bundle/src/mac.rs:57

	let app_dir = out_dir.join(APP_NAME).with_extension("app");

	clean_dir(&app_dir);

	create_app(&app_dir, APP_ID, APP_NAME, app_bin, false);

	for helper_type in [None, Some("GPU"), Some("Renderer")] {
		let helper_id_suffix = helper_type.map(|t| format!(".{t}")).unwrap_or_default();
		let helper_id = format!("{APP_ID}.helper{helper_id_suffix}");
		let helper_name_suffix = helper_type.map(|t| format!(" ({t})")).unwrap_or_default();
		let helper_name = format!("{APP_NAME} Helper{helper_name_suffix}");
		let helper_app_dir = app_dir.join(FRAMEWORKS_PATH).join(&helper_name).with_extension("app");
		create_app(&helper_app_dir, &helper_id, &helper_name, helper_bin, true);
	}

	copy_dir(&cef_path().join(CEF_FRAMEWORK), &app_dir.join(FRAMEWORKS_PATH).join(CEF_FRAMEWORK));

	let resource_dir = app_dir.join(RESOURCES_PATH);
	fs::create_dir_all(&resource_dir).expect("failed to create app resource dir");

	let icon_file = workspace_path().join("branding/app-icons").join(ICONS_FILE_NAME);
	fs::copy(icon_file, resource_dir.join(ICONS_FILE_NAME)).expect("failed to copy icon file");

	app_dir
}

fn create_app(app_dir: &Path, id: &str, name: &str, bin: &Path, is_helper: bool) {
	fs::create_dir_all(app_dir.join(EXEC_PATH)).unwrap();

	let app_contents_dir: &Path = &app_dir.join("Contents");
	create_info_plist(app_contents_dir, id, name, is_helper).unwrap();
	fs::copy(bin, app_dir.join(EXEC_PATH).join(name)).unwrap();
}

fn create_info_plist(dir: &Path, id: &str, exec_name: &str, is_helper: bool) -> Result<(), Box<dyn std::error::Error>> {
	let info = InfoPlist {
		cf_bundle_name: exec_name.to_string(),

View on GitHub (pinned to c507b35645)

Solutions

  1. Delete the partially-created Graphite.app output directory and re-run the bundler so it starts from a clean tree
  2. Check write permission on the bundle output directory (chmod/chown) and that the volume is not read-only
  3. Verify no regular file exists anywhere along the app_dir/Contents/Resources path (remove it or the stale bundle)
  4. Confirm free disk space with df -h and free space if needed

Example fix

// before
fs::create_dir_all(&resource_dir).expect("failed to create app resource dir");

// after
fs::create_dir_all(&resource_dir).unwrap_or_else(|e| panic!("failed to create app resource dir at {}: {e}", resource_dir.display()));
Defensive patterns

Strategy: validation

Validate before calling

// Before bundling, ensure no regular file blocks the directory chain and the parent is writable
fn can_create_resource_dir(app_dir: &Path) -> bool {
	let resource_dir = app_dir.join(RESOURCES_PATH);
	let mut cur = PathBuf::new();
	for comp in resource_dir.components() {
		cur.push(comp);
		if cur.exists() && !cur.is_dir() {
			return false; // a file occupies a directory slot
		}
	}
	let probe = resource_dir.with_extension("probe");
	std::fs::create_dir_all(&resource_dir).is_ok() && std::fs::File::create(&probe).is_ok() && std::fs::remove_file(&probe).is_ok()
}

Prevention

When it happens

Trigger: Running the desktop bundle binary for macOS when a previous interrupted run left a plain file where a directory is expected (e.g. a file named Resources under Contents), when the output directory is not writable by the current user, when the target volume is read-only, or when the disk is out of space.

Common situations: Building the bundle into a target/ or product directory owned by root or another user; a partially-created bundle from a crashed earlier run; running the bundler on a full disk or in a sandboxed/managed macOS environment that restricts writes to the build directory.

Related errors


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