GraphiteEditor/Graphite · critical
Regular Polygon can't be found
Error message
Regular Polygon can't be found
What it means
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.
Source
Thrown at editor/src/messages/tool/common_functionality/shapes/polygon_shape.rs:111
return Some(MouseCursorIcon::Default);
}
None
}
fn cleanup(&mut self) {
self.number_of_points_dial.cleanup();
self.point_radius_handle.cleanup();
}
}
#[derive(Default)]
pub struct Polygon;
impl Polygon {
pub fn create_node(vertices: u32) -> NodeTemplate {
let identifier = DefinitionIdentifier::ProtoNode(graphene_std::vector::generator_nodes::regular_polygon::IDENTIFIER);
let node_type = resolve_document_node_type(&identifier).expect("Regular Polygon can't be found");
node_type.node_template_input_override([None, Some(NodeInput::value(TaggedValue::U32(vertices), false)), Some(NodeInput::value(TaggedValue::F64(0.5), false))])
}
pub fn update_shape(
document: &DocumentMessageHandler,
ipp: &InputPreprocessorMessageHandler,
viewport: &ViewportMessageHandler,
layer: LayerNodeIdentifier,
shape_tool_data: &mut ShapeToolData,
modifier: ShapeToolModifierKey,
responses: &mut VecDeque<Message>,
) {
let [center, lock_ratio, _] = modifier;
if let Some([start, end]) = shape_tool_data.data.calculate_points(document, ipp, viewport, center, lock_ratio) {
// TODO: We need to determine how to allow the polygon node to make irregular shapes
update_radius_sign(end, start, layer, document, responses);
View on GitHub (pinned to c507b35645)
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
Example fix
// before
let node_type = resolve_document_node_type(&identifier).expect("Regular Polygon can't be found");
// after
let Some(node_type) = resolve_document_node_type(&identifier) else {
log::error!("Regular Polygon node definition missing from DOCUMENT_NODE_TYPES");
return None;
}; Defensive patterns
Strategy: validation
Validate before calling
assert!( document_node_definitions::resolve_document_node_type(&DefinitionIdentifier::ProtoNode(graphene_std::vector::generator_nodes::regular_polygon::IDENTIFIER)).is_some(), "Regular Polygon generator not registered" );
Prevention
- 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
When it happens
Trigger: Drawing with the Polygon tool when regular_polygon::IDENTIFIER has no DOCUMENT_NODE_TYPES entry — renamed implementation, removed node, or edited registration list.
Common situations: Refactors renaming the regular_polygon module; Graphite upgrades re-namespacing generator nodes; feature-gated builds excluding the polygon generator.
Related errors
AI-assisted analysis of GraphiteEditor/Graphite@c507b35645 (2026-08-16).
Data as JSON: /api/errors/a5498ad6465055cd.
Report an issue: GitHub.