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.