Skip to main content
Question

API Bug: “Node is not extensible” Error When Assigning Variable References to Supported Nodes

  • February 20, 2025
  • 5 replies
  • 72 views

George Kovacs

Description:

I am experiencing an issue with the Figma Plugin API when trying to assign variable references to node fills and strokes. Despite using a minimal file with supported node types (e.g., a simple rectangle), the plugin code fails with the error:

"Node is not extensible; skipping variable linking for fills."

 

and similarly for strokes. This error is triggered even though the node is not locked, is not a component, and variable linking is enabled in my file and account (I am on a Pro plan).

 

Steps to Reproduce:

1. Create a new Figma file and insert a basic shape (e.g., a rectangle).

2. Define a local color style for a solid fill and create a local color variable in a variable collection with at least one mode (e.g., Light mode).

3. Write a minimal plugin that:

• Retrieves the local paint styles and color variables using the async APIs (e.g., getLocalPaintStylesAsync and getLocalVariablesAsync).

• Attempts to assign the variable reference by setting the fillVariableId (or strokeVariableId) property on the node.

4. Run the plugin.

5. Observe that the plugin logs the error “Node is not extensible; skipping variable linking for fills.” and the node only receives the literal hex color instead of an active variable reference.

 

Expected Behavior:

The node should accept the variable reference assignment (via fillVariableId or strokeVariableId) so that the fill or stroke is linked to the corresponding variable, rather than only applying the literal color.

 

Observed Behavior:

The node appears to be non‑extensible (even though it’s a basic, unlocked, non-component shape) and does not allow assignment of the new variable linking properties. As a result, the plugin falls back to applying the literal hex value, and the error “Node is not extensible” is thrown.

 

Environment:

• Figma Desktop Version: [e.g., 108.2]

• Figma Plugin API Version: [current]

• Account Plan: Pro

• File: Minimal file with a simple rectangle and defined local color variable

 

Additional Context:

I’ve tried a two-phase approach in my plugin code (first applying the literal hex color, then assigning the variable reference) and implemented extensive error handling and batching, but the error still occurs. The node in question is confirmed to be extensible in terms of UI editing, yet its underlying JavaScript object appears to be non‑extensible.

 

I have also reviewed documentation and various developer discussions, which indicate that this error may stem from internal Figma handling of node objects. I would appreciate any guidance or a fix for this behavior, as it prevents me from programmatically linking variables as intended.

5 replies

y_toku
Figmate
  • Community Support
  • 2478 replies
  • February 20, 2025

Hi there,

 

Thanks for reaching out. I'm checking with our internal team. I will get back to you when I have anything I can share with you. 

 

Thanks for your patience.

Toku

 


tank666
  • 4871 replies
  • February 20, 2025
George Kovacs wrote:

Attempts to assign the variable reference by setting the fillVariableId (or strokeVariableId) property on the node.

Such properties do not exist in the Plugin API.

Please describe in more detail what properties and methods you used, or provide a code snippet sufficient to reproduce the error.


George Kovacs
  • Author
  • New Member
  • 2 replies
  • February 20, 2025

Below is a minimal code snippet that reproduces the issue. Although the properties fillVariableId and strokeVariableId aren’t currently documented in the official Plugin API, I attempted to set them via a type cast (using (node as any)) based on early information about Figma’s experimental variable linking functionality.

 

// Minimal reproduction snippet for variable linking

// Assume a rectangle is selected on the current page.

const node = figma.currentPage.selection[0];

if (!node) {

  figma.notify("Please select a node first.");

  figma.closePlugin();

  return;

}

// Check if the node supports fills and isn’t mixed.

if ("fills" in node && node.fills !== figma.mixed) {

  // Attempt to assign a variable reference.

  try {

    // Here, "1234567890" represents a valid variable ID in your file.

    (node as any).fillVariableId = "1234567890";

    figma.notify("Variable reference assigned successfully.");

  } catch (error) {

    console.error("Error assigning fill variable reference:", error);

    figma.notify("Failed to assign variable reference.");

  }

}

figma.closePlugin();

 

Explanation

Properties Used:

In the snippet, I use (node as any).fillVariableId to attempt assigning a variable reference to the node’s fill. This property isn’t documented in the public Plugin API (as noted by George Kovacs), but I’m using it based on experimental reports and early discussions about Figma’s variable linking.

Methods Used:

The snippet uses standard methods like figma.currentPage.selection to get a node and then checks its fills property. The assignment is wrapped in a try/catch block to capture errors like “object is not extensible.”

Reproduction:

When you run this snippet on a minimal file (with a supported node type, such as a rectangle) that isn’t locked or a component, you should observe either that the variable reference is applied or an error is thrown. In my case, it consistently throws an error indicating that the node object is not extensible, which suggests an internal API or implementation issue.


tank666
  • 4871 replies
  • February 20, 2025

Don't use this AI crap. Use REAL APIs, not some bots' inventions.

See an example of how to bind a variable to a fill here: Working with Variables.

And also be sure to read this article: Editing properties.


George Kovacs
  • Author
  • New Member
  • 2 replies
  • February 20, 2025

Great, thanks Yury; I'll try your suggestions! I'm not familiar with programming, so I'm using AI, hence the "great" result. 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings