Skip to content

set_annotation / get_annotations fails on deeply nested instance nodes (3+ semicolons in node ID) #169

@kkjjjy1b

Description

@kkjjjy1b

Problem

set_annotation and get_annotations silently fail when targeting nodes
whose ID contains 3 or more semicolons (i.e., nested 3+ levels deep inside
component instances).

Node ID Depth Reference

Node ID format Depth Works?
FRAME_ID 0
I{A};{B} 1
I{A};{B};{C} 2
I{A};{B};{C};{D} 3 ❌ Returns null / no-op

Root Cause (suspected)

The Figma plugin code appears to use the synchronous figma.getNodeById(id),
which is deprecated and known to return null for nodes deep inside nested
instances.

The asynchronous figma.getNodeByIdAsync(id) correctly resolves nodes at
any depth and is the recommended replacement per Figma's plugin API docs.

Reference: https://www.figma.com/plugin-docs/api/figma/#getnodebyidasync

Impact

When the top-level frame is a component instance (not a plain frame),
almost all meaningful child nodes fall at depth 3 or deeper. This makes
set_annotation effectively unusable in component-heavy design files.

As a workaround, users have been wrapping instances in plain frames to
shallow the node depth — but this breaks Figma's master component sync
and slot override propagation
, causing design system regressions.

Suggested Fix

Replace figma.getNodeById(id) with figma.getNodeByIdAsync(id) in the
plugin code where node lookup is performed before annotation operations.

- const node = figma.getNodeById(nodeId);
+ const node = await figma.getNodeByIdAsync(nodeId);

This should resolve the depth limitation without any breaking changes to
the existing API surface.

Environment

- Tool: TalkToFigma MCP (cursor-talk-to-figma-mcp)
- Affected tools: set_annotation, get_annotations
- Figma file structure: screens built entirely from component instances
(no plain frames at top level)


This is writed by claude

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions