{"record":{"id":"a2881f88043551d8","repo":"GraphiteEditor/Graphite","slug":"grid-can-t-be-found","errorCode":null,"errorMessage":"Grid can't be found","messagePattern":"Grid can't be found","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"editor/src/messages/tool/common_functionality/shapes/grid_shape.rs","lineNumber":86,"sourceCode":"\tfn cleanup(&mut self) {\n\t\tself.row_column_gizmo.cleanup();\n\t}\n\n\tfn mouse_cursor_icon(&self) -> Option<MouseCursorIcon> {\n\t\tif self.row_column_gizmo.is_hovered() || self.row_column_gizmo.is_dragging() {\n\t\t\treturn Some(self.row_column_gizmo.gizmo_type.mouse_icon());\n\t\t}\n\n\t\tNone\n\t}\n}\n\n#[derive(Default)]\npub struct Grid;\n\nimpl Grid {\n\tpub fn create_node(grid_type: GridType) -> NodeTemplate {\n\t\tlet node_type = resolve_proto_node_type(graphene_std::vector::generator_nodes::grid::IDENTIFIER).expect(\"Grid can't be found\");\n\t\tnode_type.node_template_input_override([\n\t\t\tNone,\n\t\t\tSome(NodeInput::value(TaggedValue::GridType(grid_type), false)),\n\t\t\tSome(NodeInput::value(TaggedValue::DVec2(DVec2::ZERO), false)),\n\t\t])\n\t}\n\n\tpub fn update_shape(\n\t\tdocument: &DocumentMessageHandler,\n\t\tipp: &InputPreprocessorMessageHandler,\n\t\tlayer: LayerNodeIdentifier,\n\t\tgrid_type: GridType,\n\t\tshape_tool_data: &mut ShapeToolData,\n\t\tmodifier: ShapeToolModifierKey,\n\t\tresponses: &mut VecDeque<Message>,\n\t) {\n\t\tuse graphene_std::vector::generator_nodes::grid::*;\n","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/GraphiteEditor/Graphite/blob/c507b356453361e31638b8bff8f6d46b6da2961e/editor/src/messages/tool/common_functionality/shapes/grid_shape.rs#L68-L104","documentation":"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.","triggerScenarios":"Starting a Grid tool drag when generator_nodes::grid::IDENTIFIER has no DOCUMENT_NODE_TYPES entry — renamed const, node removed, or registration list edited.","commonSituations":"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.","solutions":["Verify the grid identifier key exists in DOCUMENT_NODE_TYPES and matches the const","Re-align identifier/registration and rebuild","Replace expect with let-else returning Option<NodeTemplate> for graceful degradation","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"],"exampleFix":"// before\nlet node_type = resolve_proto_node_type(graphene_std::vector::generator_nodes::grid::IDENTIFIER).expect(\"Grid can't be found\");\n// after\nlet Some(node_type) = resolve_proto_node_type(graphene_std::vector::generator_nodes::grid::IDENTIFIER) else {\n\tlog::error!(\"Grid node definition missing from DOCUMENT_NODE_TYPES\");\n\treturn None;\n};","handlingStrategy":"validation","validationCode":"fn grid_node_available() -> bool {\n\tdocument_node_definitions::resolve_proto_node_type(graphene_std::vector::generator_nodes::grid::IDENTIFIER).is_some()\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add grid (and every tool-inserted node) to the registry-drift test","When the Grid node's inputs change, update the override array in the same commit — node_template_input_override indexes template.inputs directly and panics on overflow","Prefer resolve_proto_node_type over hand-built DefinitionIdentifier values to reduce divergence"],"tags":["rust","graphite","panic","expect","node-registry","grid-tool"],"backgroundTag":"node-definition-not-found","analyzedSha":"c507b356453361e31638b8bff8f6d46b6da2961e","analyzedAt":"2026-08-16T21:57:18.596Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}