{"record":{"id":"57912cd501cca8e0","repo":"GraphiteEditor/Graphite","slug":"failed-to-expand-network","errorCode":null,"errorMessage":"Failed to expand network","messagePattern":"Failed to expand network","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"node-graph/graphene-cli/src/main.rs","lineNumber":280,"sourceCode":"\t\t\t\trecord.module_path().unwrap_or(\"\"),\n\t\t\t\tmessage\n\t\t\t))\n\t\t})\n\t\t.apply()\n\t\t.unwrap();\n}\n\nfn compile_graph(network: NodeNetwork, editor_api: Arc<PlatformEditorApi>, gdd: Option<&GddV1>) -> Result<ProtoNetwork, Box<dyn Error>> {\n\tlet preprocessor = preprocessor::Preprocessor::new();\n\n\tlet mut network = wrap_network_in_scope(network, editor_api);\n\n\t// A `.gdd` resolves resource hashes from its registry; a legacy `.graphite` has no resource store, so it\n\t// preprocesses against an empty registry (matching the pre-`.gdd` CLI behavior).\n\tmatch gdd {\n\t\tSome(gdd) => preprocessor\n\t\t\t.preprocess(&mut network, &|resource_id| gdd.registry().resources.get(&resource_id).and_then(|r| r.hash))\n\t\t\t.expect(\"Failed to expand network\"),\n\t\tNone => { preprocessor.preprocess(&mut network, &|_| None) }.expect(\"Failed to expand network\"),\n\t}\n\n\tlet compiler = Compiler {};\n\tcompiler.compile_single(network).map_err(|x| x.into())\n}\n\nfn create_executor(proto_network: ProtoNetwork) -> Result<DynamicExecutor, Box<dyn Error>> {\n\tlet 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())?;\n\tOk(executor)\n}\n","sourceCodeStart":262,"sourceCodeEnd":292,"githubUrl":"https://github.com/GraphiteEditor/Graphite/blob/c507b356453361e31638b8bff8f6d46b6da2961e/node-graph/graphene-cli/src/main.rs#L262-L292","documentation":"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.","triggerScenarios":"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.","commonSituations":"CLI-rendering artwork saved by a different editor version; a .gdd whose registry was pruned or belongs to another document; hand-modified networks.","solutions":["Open the same file in the desktop editor first to see its friendlier diagnostic","Replace .expect with map_err propagation so the CLI prints the actual preprocessor error instead of a bare panic message","Verify the .gdd passed to the CLI is the one that matches the network being compiled"],"exampleFix":"// before\npreprocessor.preprocess(&mut network, &resolver).expect(\"Failed to expand network\");\n\n// after\npreprocessor.preprocess(&mut network, &resolver).map_err(|e| -> Box<dyn Error> { format!(\"failed to expand network: {e:?}\").into() })?;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match preprocessor.preprocess(&mut network, &resolver) {\n\tOk(()) => {}\n\tErr(e) => return Err(format!(\"failed to expand network: {e:?}\").into()),\n}","preventionTips":["Open suspicious artwork in the desktop editor before CLI-rendering it","Keep the .gdd registry and the network it came from together as one unit","Upgrade the CLI and editor in lockstep so the preprocessor matches the document version"],"tags":["cli","preprocessor","node-graph","graphite"],"backgroundTag":"preprocessor-expansion-failed","analyzedSha":"c507b356453361e31638b8bff8f6d46b6da2961e","analyzedAt":"2026-08-16T21:57:18.596Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}