{"record":{"id":"a5498ad6465055cd","repo":"GraphiteEditor/Graphite","slug":"regular-polygon-can-t-be-found","errorCode":null,"errorMessage":"Regular Polygon can't be found","messagePattern":"Regular Polygon can't be found","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"editor/src/messages/tool/common_functionality/shapes/polygon_shape.rs","lineNumber":111,"sourceCode":"\t\t\treturn Some(MouseCursorIcon::Default);\n\t\t}\n\n\t\tNone\n\t}\n\n\tfn cleanup(&mut self) {\n\t\tself.number_of_points_dial.cleanup();\n\t\tself.point_radius_handle.cleanup();\n\t}\n}\n\n#[derive(Default)]\npub struct Polygon;\n\nimpl Polygon {\n\tpub fn create_node(vertices: u32) -> NodeTemplate {\n\t\tlet identifier = DefinitionIdentifier::ProtoNode(graphene_std::vector::generator_nodes::regular_polygon::IDENTIFIER);\n\t\tlet node_type = resolve_document_node_type(&identifier).expect(\"Regular Polygon can't be found\");\n\t\tnode_type.node_template_input_override([None, Some(NodeInput::value(TaggedValue::U32(vertices), false)), Some(NodeInput::value(TaggedValue::F64(0.5), false))])\n\t}\n\n\tpub fn update_shape(\n\t\tdocument: &DocumentMessageHandler,\n\t\tipp: &InputPreprocessorMessageHandler,\n\t\tviewport: &ViewportMessageHandler,\n\t\tlayer: LayerNodeIdentifier,\n\t\tshape_tool_data: &mut ShapeToolData,\n\t\tmodifier: ShapeToolModifierKey,\n\t\tresponses: &mut VecDeque<Message>,\n\t) {\n\t\tlet [center, lock_ratio, _] = modifier;\n\n\t\tif let Some([start, end]) = shape_tool_data.data.calculate_points(document, ipp, viewport, center, lock_ratio) {\n\t\t\t// TODO: We need to determine how to allow the polygon node to make irregular shapes\n\t\t\tupdate_radius_sign(end, start, layer, document, responses);\n","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/GraphiteEditor/Graphite/blob/c507b356453361e31638b8bff8f6d46b6da2961e/editor/src/messages/tool/common_functionality/shapes/polygon_shape.rs#L93-L129","documentation":"Polygon::create_node resolves the regular-polygon generator via DefinitionIdentifier::ProtoNode(graphene_std::vector::generator_nodes::regular_polygon::IDENTIFIER) and resolve_document_node_type(...).expect(\"Regular Polygon can't be found\") (polygon_shape.rs:111). The resolver is a static HashMap lookup in DOCUMENT_NODE_TYPES (document_node_definitions.rs:130/1484); None means the Regular Polygon node is unregistered, and the expect panics the first time the Polygon tool creates a layer.","triggerScenarios":"Drawing with the Polygon tool when regular_polygon::IDENTIFIER has no DOCUMENT_NODE_TYPES entry — renamed implementation, removed node, or edited registration list.","commonSituations":"Refactors renaming the regular_polygon module; Graphite upgrades re-namespacing generator nodes; feature-gated builds excluding the polygon generator.","solutions":["Verify the regular_polygon identifier key exists in DOCUMENT_NODE_TYPES and matches the const byte-for-byte","Repair the drift and rebuild","Use let-else so the polygon tool degrades with a log instead of a panic","Add the identifier to the cross-tool registry test"],"exampleFix":"// before\nlet node_type = resolve_document_node_type(&identifier).expect(\"Regular Polygon can't be found\");\n// after\nlet Some(node_type) = resolve_document_node_type(&identifier) else {\n\tlog::error!(\"Regular Polygon node definition missing from DOCUMENT_NODE_TYPES\");\n\treturn None;\n};","handlingStrategy":"validation","validationCode":"assert!(\n\tdocument_node_definitions::resolve_document_node_type(&DefinitionIdentifier::ProtoNode(graphene_std::vector::generator_nodes::regular_polygon::IDENTIFIER)).is_some(),\n\t\"Regular Polygon generator not registered\"\n);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify registry membership for every node referenced by tool create_node functions in one shared test","Grep identifier strings before module renames in generator_nodes","Keep override arrays ([None, Some(U32), Some(F64)]) in lockstep with node input changes"],"tags":["rust","graphite","panic","expect","node-registry","polygon-tool"],"backgroundTag":"node-definition-not-found","analyzedSha":"c507b356453361e31638b8bff8f6d46b6da2961e","analyzedAt":"2026-08-16T21:57:18.596Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}