GraphiteEditor/Graphite · critical

Arrow node can't be found

Error message

Arrow node can't be found

What it means

Arrow::create_node builds a DefinitionIdentifier::ProtoNode for graphene_std::vector_nodes::arrow::IDENTIFIER, resolves it via resolve_document_node_type (document_node_definitions.rs:1484 — a HashMap::get on the static DOCUMENT_NODE_TYPES), and unwraps with .expect("Arrow node can't be found") (arrow_shape.rs:25). The panic means the Arrow proto node is not registered in document_node_definitions(); it is a build/registration defect triggered the moment the Arrow tool tries to create its layer.

Source

Thrown at editor/src/messages/tool/common_functionality/shapes/arrow_shape.rs:25

use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeTemplate};
use crate::messages::prelude::*;
use crate::messages::tool::common_functionality::graph_modification_utils;
pub use crate::messages::tool::common_functionality::graph_modification_utils::NodeGraphLayer;
use crate::messages::tool::common_functionality::snapping::SnapData;
use glam::{DAffine2, DVec2};
use graph_craft::document::NodeInput;
use graph_craft::document::value::TaggedValue;
use std::collections::VecDeque;

#[derive(Default)]
pub struct Arrow;

impl Arrow {
	pub fn create_node(shaft_width: f64, head_width: f64, head_length: f64) -> NodeTemplate {
		let identifier = DefinitionIdentifier::ProtoNode(graphene_std::vector_nodes::arrow::IDENTIFIER);
		let node_type = resolve_document_node_type(&identifier).expect("Arrow node can't be found");
		node_type.node_template_input_override([
			None,
			Some(NodeInput::value(TaggedValue::DVec2(DVec2::ZERO), false)), // arrow_to
			Some(NodeInput::value(TaggedValue::F64(shaft_width), false)),   // shaft_width
			Some(NodeInput::value(TaggedValue::F64(head_width), false)),    // head_width
			Some(NodeInput::value(TaggedValue::F64(head_length), false)),   // head_length
		])
	}

	pub fn update_shape(
		document: &DocumentMessageHandler,
		input: &InputPreprocessorMessageHandler,
		viewport: &ViewportMessageHandler,
		layer: LayerNodeIdentifier,
		tool_data: &mut ShapeToolData,
		modifier: ShapeToolModifierKey,
		responses: &mut VecDeque<Message>,
	) {

View on GitHub (pinned to c507b35645)

Solutions

  1. Verify the arrow identifier appears as a key in DOCUMENT_NODE_TYPES (grep the identifier string in document_node_definitions.rs)
  2. Re-align the IDENTIFIER const and the registration key, then rebuild
  3. Return Option<NodeTemplate> from create_node and have the tool skip layer creation with a log when None
  4. Add a registry test enumerating every shape-tool identifier (Arrow, Circle, Ellipse, Line, Polygon, Rectangle, Spiral, Arc, Grid)

Example fix

// before
let node_type = resolve_document_node_type(&identifier).expect("Arrow node can't be found");
// after
let Some(node_type) = resolve_document_node_type(&identifier) else {
	log::error!("Arrow node definition missing; cannot create arrow layer");
	return None;
};
Defensive patterns

Strategy: validation

Validate before calling

fn arrow_node_available() -> bool {
	let identifier = DefinitionIdentifier::ProtoNode(graphene_std::vector_nodes::arrow::IDENTIFIER);
	document_node_definitions::resolve_document_node_type(&identifier).is_some()
}

Prevention

When it happens

Trigger: Selecting the Arrow tool and dragging to draw while vector_nodes::arrow::IDENTIFIER is absent from DOCUMENT_NODE_TYPES — node renamed, deleted, or its registration entry dropped.

Common situations: Refactors of the vector_nodes crate that move Arrow to a different module path; version upgrades reorganizing proto vs network nodes; local forks disabling arrow support without removing the tool.

Related errors


AI-assisted analysis of GraphiteEditor/Graphite@c507b35645 (2026-08-16). Data as JSON: /api/errors/de36380f6cbcf0ed. Report an issue: GitHub.