GraphiteEditor/Graphite · error

Path node does not exist

Error message

Path node does not exist

What it means

process_tool_data for the pen tool pre-creates a new Path layer so the next click can extend it, resolving the built-in 'Path' network node by name with resolve_network_node_type("Path").expect(...). The lookup goes through the DOCUMENT_NODE_TYPES static registry keyed by DefinitionIdentifier::Network("Path"); a miss means the structural Path node definition is absent or renamed in this build. The panic strikes as soon as the pen tool is used to start a new path, at layer creation time.

Source

Thrown at editor/src/messages/tool/tool_messages/pen_tool.rs:1350

			if let Some(layer) = existing_layer {
				// Add point to existing layer
				responses.add(PenToolMessage::AddPointLayerPosition { layer, viewport: viewport_vec });
				return;
			}
		}

		if let Some((layer, point, _position)) = closest_point(document, viewport_vec, tolerance, document.metadata().all_layers(), |_| false) {
			let vector = document.network_interface.compute_modified_vector(layer).unwrap();
			let segment = vector.all_connected(point).collect::<Vec<_>>().first().map(|s| s.segment);
			self.handle_mode = HandleMode::Free;
			if self.modifiers.lock_angle {
				self.set_lock_angle(&vector, point, segment);
				self.switch_to_free_on_ctrl_release = true;
			}
		}

		// New path layer
		let node_type = resolve_network_node_type("Path").expect("Path node does not exist");
		let nodes = vec![(NodeId(0), node_type.default_node_template())];

		let parent = document.new_layer_bounding_artboard(input, viewport);
		let layer = graph_modification_utils::new_custom(NodeId::new(), nodes, parent, responses);
		self.current_layer = Some(layer);
		tool_options.drawing.fill.apply_fill(layer, responses);
		tool_options.drawing.apply_stroke_to_new_layer(layer, responses);
		tool_options.drawing.apply_stroke_order_to_new_layer(layer, responses);
		self.prior_segment = None;
		self.prior_segments = None;
		responses.add(NodeGraphMessage::SelectedNodesSet { nodes: vec![layer.to_node()] });

		// Set up the first point at local origin (0,0) and position the layer at the viewport location via Transform
		let id = PointId::generate();
		self.add_point(LastPoint {
			id,
			pos: DVec2::ZERO,
			in_segment: None,

View on GitHub (pinned to c507b35645)

Solutions

  1. Verify a Network definition named exactly "Path" exists in the registry (inspect collect_node_types() output).
  2. Centralize the name in one constant shared by the definition site and the three tool call sites to eliminate literal drift.
  3. If the node was renamed, re-add it under the old key or update all call sites in the same commit (search resolve_network_node_type("Path") across the repo).
  4. Convert the expect into an early-return with an error log if pen-tool path creation should degrade gracefully on exotic builds.

Example fix

// before
let node_type = resolve_network_node_type("Path").expect("Path node does not exist");
let nodes = vec![(NodeId(0), node_type.default_node_template())];

// after
let Some(node_type) = resolve_network_node_type(PATH_NODE_NAME) else {
	log::error!("Path network node missing from registry; pen tool cannot start a path");
	return;
};
let nodes = vec![(NodeId(0), node_type.default_node_template())];
Defensive patterns

Strategy: validation

Validate before calling

if let Some(node_type) = resolve_network_node_type("Path") {
	let nodes = vec![(NodeId(0), node_type.default_node_template())];
	// create the pen layer
} else {
	// registry drift: log and disable pen tool start
}

Prevention

When it happens

Trigger: Activating the pen tool and clicking to begin a path (the tool-data processing step after the closest-point snapping check), which runs resolve_network_node_type("Path").expect("Path node does not exist") and feeds the default template into graph_modification_utils::new_custom.

Common situations: The Path network node definition was renamed or removed in document_node_definitions.rs during refactoring while freehand_tool.rs, pen_tool.rs, and spline_tool.rs keep literal "Path" strings; localization passes changing node display/registry names; forks that restructured structural nodes without a compatibility alias.

Related errors


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