GraphiteEditor/Graphite · critical

Grid can't be found

Error message

Grid can't be found

What it means

Grid::create_node resolves the Grid generator node with resolve_proto_node_type(graphene_std::vector::generator_nodes::grid::IDENTIFIER).expect("Grid can't be found") (grid_shape.rs:86). The resolver performs a static-registry lookup (DOCUMENT_NODE_TYPES, document_node_definitions.rs:130) and returns None when the grid identifier is unregistered; the expect turns that into a panic the first time the Grid tool creates a layer. The subsequent node_template_input_override call indexes template.inputs directly (document_node_definitions.rs:1536), so keeping the override array aligned with the node's declared inputs matters too.

Source

Thrown at editor/src/messages/tool/common_functionality/shapes/grid_shape.rs:86

	fn cleanup(&mut self) {
		self.row_column_gizmo.cleanup();
	}

	fn mouse_cursor_icon(&self) -> Option<MouseCursorIcon> {
		if self.row_column_gizmo.is_hovered() || self.row_column_gizmo.is_dragging() {
			return Some(self.row_column_gizmo.gizmo_type.mouse_icon());
		}

		None
	}
}

#[derive(Default)]
pub struct Grid;

impl Grid {
	pub fn create_node(grid_type: GridType) -> NodeTemplate {
		let node_type = resolve_proto_node_type(graphene_std::vector::generator_nodes::grid::IDENTIFIER).expect("Grid can't be found");
		node_type.node_template_input_override([
			None,
			Some(NodeInput::value(TaggedValue::GridType(grid_type), false)),
			Some(NodeInput::value(TaggedValue::DVec2(DVec2::ZERO), false)),
		])
	}

	pub fn update_shape(
		document: &DocumentMessageHandler,
		ipp: &InputPreprocessorMessageHandler,
		layer: LayerNodeIdentifier,
		grid_type: GridType,
		shape_tool_data: &mut ShapeToolData,
		modifier: ShapeToolModifierKey,
		responses: &mut VecDeque<Message>,
	) {
		use graphene_std::vector::generator_nodes::grid::*;

View on GitHub (pinned to c507b35645)

Solutions

  1. Verify the grid identifier key exists in DOCUMENT_NODE_TYPES and matches the const
  2. Re-align identifier/registration and rebuild
  3. Replace expect with let-else returning Option<NodeTemplate> for graceful degradation
  4. When the Grid node's input list changes, update the override array in the same commit to avoid the neighboring index panic in node_template_input_override

Example fix

// before
let node_type = resolve_proto_node_type(graphene_std::vector::generator_nodes::grid::IDENTIFIER).expect("Grid can't be found");
// after
let Some(node_type) = resolve_proto_node_type(graphene_std::vector::generator_nodes::grid::IDENTIFIER) else {
	log::error!("Grid node definition missing from DOCUMENT_NODE_TYPES");
	return None;
};
Defensive patterns

Strategy: validation

Validate before calling

fn grid_node_available() -> bool {
	document_node_definitions::resolve_proto_node_type(graphene_std::vector::generator_nodes::grid::IDENTIFIER).is_some()
}

Prevention

When it happens

Trigger: Starting a Grid tool drag when generator_nodes::grid::IDENTIFIER has no DOCUMENT_NODE_TYPES entry — renamed const, node removed, or registration list edited.

Common situations: Renaming the grid generator during refactors; version upgrades that re-namespace generator nodes; feature-gated builds without the grid module; override arrays left stale after the node gains/loses inputs.

Related errors


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