GraphiteEditor/Graphite · critical
Line node can't be found
Error message
Line node can't be found
What it means
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.
Source
Thrown at editor/src/messages/tool/common_functionality/shapes/line_shape.rs:42
#[derive(Clone, Debug, Default)]
pub struct LineToolData {
pub drag_start: DVec2,
pub drag_current: DVec2,
pub angle: f64,
pub weight: f64,
pub selected_layers_with_position: HashMap<LayerNodeIdentifier, [DVec2; 2]>,
pub editing_layer: Option<LayerNodeIdentifier>,
pub dragging_endpoint: Option<LineEnd>,
}
#[derive(Default)]
pub struct Line;
impl Line {
pub fn create_node() -> NodeTemplate {
let identifier = DefinitionIdentifier::ProtoNode(graphene_std::vector::generator_nodes::line::IDENTIFIER);
let node_type = resolve_document_node_type(&identifier).expect("Line node can't be found");
node_type.node_template_input_override([None, Some(NodeInput::value(TaggedValue::DVec2(DVec2::ZERO), 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, snap_angle, lock_angle] = modifier;
shape_tool_data.line_data.drag_current = ipp.mouse.position;
let keyboard = &ipp.keyboard;
let ignore = [layer];View on GitHub (pinned to c507b35645)
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
Example fix
// before
let node_type = resolve_document_node_type(&identifier).expect("Line node can't be found");
// after
let Some(node_type) = resolve_document_node_type(&identifier) else {
log::error!("Line node definition missing from DOCUMENT_NODE_TYPES");
return None;
}; Defensive patterns
Strategy: validation
Validate before calling
#[test]
fn line_node_registered() {
let identifier = DefinitionIdentifier::ProtoNode(graphene_std::vector::generator_nodes::line::IDENTIFIER);
assert!(document_node_definitions::resolve_document_node_type(&identifier).is_some());
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: Module moves of the line generator; upgrades between Graphite revisions changing identifier strings; forks removing the Line node but keeping the tool code.
Related errors
AI-assisted analysis of GraphiteEditor/Graphite@c507b35645 (2026-08-16).
Data as JSON: /api/errors/e83114c0456800a1.
Report an issue: GitHub.