{"record":{"id":"e83114c0456800a1","repo":"GraphiteEditor/Graphite","slug":"line-node-can-t-be-found","errorCode":null,"errorMessage":"Line node can't be found","messagePattern":"Line node can't be found","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"editor/src/messages/tool/common_functionality/shapes/line_shape.rs","lineNumber":42,"sourceCode":"\n#[derive(Clone, Debug, Default)]\npub struct LineToolData {\n\tpub drag_start: DVec2,\n\tpub drag_current: DVec2,\n\tpub angle: f64,\n\tpub weight: f64,\n\tpub selected_layers_with_position: HashMap<LayerNodeIdentifier, [DVec2; 2]>,\n\tpub editing_layer: Option<LayerNodeIdentifier>,\n\tpub dragging_endpoint: Option<LineEnd>,\n}\n\n#[derive(Default)]\npub struct Line;\n\nimpl Line {\n\tpub fn create_node() -> NodeTemplate {\n\t\tlet identifier = DefinitionIdentifier::ProtoNode(graphene_std::vector::generator_nodes::line::IDENTIFIER);\n\t\tlet node_type = resolve_document_node_type(&identifier).expect(\"Line node can't be found\");\n\t\tnode_type.node_template_input_override([None, Some(NodeInput::value(TaggedValue::DVec2(DVec2::ZERO), 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, snap_angle, lock_angle] = modifier;\n\n\t\tshape_tool_data.line_data.drag_current = ipp.mouse.position;\n\n\t\tlet keyboard = &ipp.keyboard;\n\t\tlet ignore = [layer];","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/GraphiteEditor/Graphite/blob/c507b356453361e31638b8bff8f6d46b6da2961e/editor/src/messages/tool/common_functionality/shapes/line_shape.rs#L24-L60","documentation":"Line::create_node constructs DefinitionIdentifier::ProtoNode from graphene_std::vector::generator_nodes::line::IDENTIFIER, resolves it with resolve_document_node_type (document_node_definitions.rs:1484 — a get on the static DOCUMENT_NODE_TYPES map), and unwraps via .expect(\"Line node can't be found\") (line_shape.rs:42). The panic indicates the Line generator is not registered under that identifier; it triggers as soon as the Line tool attempts to insert its node.","triggerScenarios":"Beginning a line drag with the Line tool while generator_nodes::line::IDENTIFIER is absent from DOCUMENT_NODE_TYPES (rename, removal, or registration-list edit).","commonSituations":"Module moves of the line generator; upgrades between Graphite revisions changing identifier strings; forks removing the Line node but keeping the tool code.","solutions":["Confirm resolve_document_node_type(&identifier).is_some() for the line identifier (grep its string in document_node_definitions.rs)","Fix the const/registration mismatch and rebuild","Switch to let-else (or make create_node return Option<NodeTemplate>) so a missing definition is a logged, non-fatal condition","Include Line in the shared registry-drift test for all shape tools"],"exampleFix":"// before\nlet node_type = resolve_document_node_type(&identifier).expect(\"Line node can't be found\");\n// after\nlet Some(node_type) = resolve_document_node_type(&identifier) else {\n\tlog::error!(\"Line node definition missing from DOCUMENT_NODE_TYPES\");\n\treturn None;\n};","handlingStrategy":"validation","validationCode":"#[test]\nfn line_node_registered() {\n\tlet identifier = DefinitionIdentifier::ProtoNode(graphene_std::vector::generator_nodes::line::IDENTIFIER);\n\tassert!(document_node_definitions::resolve_document_node_type(&identifier).is_some());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the DefinitionIdentifier construction next to the IDENTIFIER const so moves update both","Include the Line tool in cross-tool registry tests","Use let-else in tool code so unregistered nodes produce logs, not panics, in shipped builds"],"tags":["rust","graphite","panic","expect","node-registry","line-tool"],"backgroundTag":"node-definition-not-found","analyzedSha":"c507b356453361e31638b8bff8f6d46b6da2961e","analyzedAt":"2026-08-16T21:57:18.596Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}