GraphiteEditor/Graphite · error

Failed to expand network

Error message

Failed to expand network

What it means

graphene-cli's compile_graph expands the loaded network through the preprocessor (resolving resource hashes from the .gdd registry when one is supplied, or an empty registry for legacy .graphite files) and panics here when preprocess returns Err. The loaded network cannot be expanded as written.

Source

Thrown at node-graph/graphene-cli/src/main.rs:280

				record.module_path().unwrap_or(""),
				message
			))
		})
		.apply()
		.unwrap();
}

fn compile_graph(network: NodeNetwork, editor_api: Arc<PlatformEditorApi>, gdd: Option<&GddV1>) -> Result<ProtoNetwork, Box<dyn Error>> {
	let preprocessor = preprocessor::Preprocessor::new();

	let mut network = wrap_network_in_scope(network, editor_api);

	// A `.gdd` resolves resource hashes from its registry; a legacy `.graphite` has no resource store, so it
	// preprocesses against an empty registry (matching the pre-`.gdd` CLI behavior).
	match gdd {
		Some(gdd) => preprocessor
			.preprocess(&mut network, &|resource_id| gdd.registry().resources.get(&resource_id).and_then(|r| r.hash))
			.expect("Failed to expand network"),
		None => { preprocessor.preprocess(&mut network, &|_| None) }.expect("Failed to expand network"),
	}

	let compiler = Compiler {};
	compiler.compile_single(network).map_err(|x| x.into())
}

fn create_executor(proto_network: ProtoNetwork) -> Result<DynamicExecutor, Box<dyn Error>> {
	let executor = block_on(DynamicExecutor::new(proto_network)).map_err(|errors| errors.iter().map(|e| format!("{e:?}")).reduce(|acc, e| format!("{acc}\n{e}")).unwrap_or_default())?;
	Ok(executor)
}

View on GitHub (pinned to c507b35645)

Solutions

  1. Open the same file in the desktop editor first to see its friendlier diagnostic
  2. Replace .expect with map_err propagation so the CLI prints the actual preprocessor error instead of a bare panic message
  3. Verify the .gdd passed to the CLI is the one that matches the network being compiled

Example fix

// before
preprocessor.preprocess(&mut network, &resolver).expect("Failed to expand network");

// after
preprocessor.preprocess(&mut network, &resolver).map_err(|e| -> Box<dyn Error> { format!("failed to expand network: {e:?}").into() })?;
Defensive patterns

Strategy: try-catch

Try / catch

match preprocessor.preprocess(&mut network, &resolver) {
	Ok(()) => {}
	Err(e) => return Err(format!("failed to expand network: {e:?}").into()),
}

Prevention

When it happens

Trigger: Structural problems during expansion: macros referencing nodes or parameters that do not exist after load; resource references the preprocessor requires but cannot resolve from the supplied .gdd; documents saved by a newer editor than the CLI build.

Common situations: CLI-rendering artwork saved by a different editor version; a .gdd whose registry was pruned or belongs to another document; hand-modified networks.

Related errors


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