GraphiteEditor/Graphite · error · syn::Error

Invalid #[implementations(...)] for argument `{}`. Expected

Error message

Invalid #[implementations(...)] for argument `{}`.
Expected a comma-separated list of `InputType -> OutputType` pairs.
Example: #[implementations(i32 -> f64, String -> Vec<u8>)]
Error: {}

What it means

The node-graph counterpart: parse_node_implementations requires each entry of #[implementations(...)] on a node parameter to be an `InputType -> OutputType` pair. This error fires when an entry is a bare type or otherwise malformed, and the message includes the argument name plus a full correct example.

Source

Thrown at node-graph/node-macro/src/parsing.rs:745

	}

	features
}

fn parse_implementations(attr: &Attribute, name: &Ident) -> syn::Result<Punctuated<Type, Comma>> {
	let content: TokenStream2 = attr.parse_args()?;
	let parser = Punctuated::<Type, Comma>::parse_terminated;
	parser.parse2(content.clone()).map_err(|e| {
		let span = e.span(); // Get the span of the error
		Error::new(span, format!("Failed to parse implementations for argument '{name}': {e}"))
	})
}

fn parse_node_implementations<T: Parse>(attr: &Attribute, name: &Ident) -> syn::Result<Punctuated<T, Comma>> {
	let content: TokenStream2 = attr.parse_args()?;
	let parser = Punctuated::<T, Comma>::parse_terminated;
	parser.parse2(content.clone()).map_err(|e| {
		Error::new(
			e.span(),
			formatdoc!(
				"Invalid #[implementations(...)] for argument `{}`.
				Expected a comma-separated list of `InputType -> OutputType` pairs.
				Example: #[implementations(i32 -> f64, String -> Vec<u8>)]
				Error: {}",
				name,
				e
			),
		)
	})
}

fn parse_field(pat_ident: PatIdent, ty: Type, attrs: &[Attribute]) -> syn::Result<ParsedField> {
	let ident = &pat_ident.ident;

	// Checks for the #[data] attribute, indicating that this is a data field rather than an input parameter to the node.
	// Data fields act as internal state, using interior mutability to cache data between node evaluations.

View on GitHub (pinned to c507b35645)

Solutions

  1. Rewrite every entry as a pair following the embedded example: #[implementations(i32 -> f64, String -> Vec<u8>)]
  2. Scan the entire list — a single malformed entry fails the whole attribute
  3. Make sure both sides of each pair are in-scope types (imports visible at the definition site)

Example fix

// before
#[implementations(f64)]

// after
#[implementations(i32 -> f64, String -> Vec<u8>)]
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: #[implementations(f64)] (missing -> OutputType); #[implementations(f64 -> )] (empty output); stray commas or mismatched brackets splitting one entry into invalid pieces.

Common situations: Assuming the older bare-type implementations grammar still works on node parameters; partial edits that leave one entry of a long list incomplete after a rename or type change.

Related errors


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