slint-ui/slint · warning
[getVariablePathString] Collection not found for variable ID
Error message
[getVariablePathString] Collection not found for variable ID: ${variableId} What it means
getVariablePathString resolves a Figma variable ID to a Slint global-qualified path (collection name + variable hierarchy). It first looks up the variable, then the variable collection that owns it. This warning is emitted when the variable exists but its owning collection cannot be fetched (getVariableCollectionByIdAsync returned null), in which case the function returns null and the caller silently falls back to a literal value instead of a variable binding.
Solutions
- Open the Figma file and check the variable's owning collection in Local variables / library; restore or re-create the deleted collection.
- Re-apply the variable to the node so variableCollectionId points at an existing collection.
- Accept the fallback: the function returns null and callers use the resolved literal value instead of a variable binding — verify the generated snippet is acceptable.
- Update the plugin / Figma desktop app in case this is a stale API session returning null collections.
Defensive patterns
Strategy: fallback
Validate before calling
const variable = await figma.variables.getVariableByIdAsync(variableId);
const collection = variable
? await figma.variables.getVariableCollectionByIdAsync(variable.variableCollectionId)
: null;
if (!variable || !collection) {
console.warn(`Variable ${variableId} unresolvable; will use literal value`);
} Type guard
function hasCollection(v: Variable | null): v is Variable & { variableCollectionId: string } {
return v != null && typeof v.variableCollectionId === 'string' && v.variableCollectionId.length > 0;
} Prevention
- Always treat getVariablePathString's null return as 'use the literal value' — never assume a variable binding exists.
- Keep Figma libraries/collections intact; audit detached or deleted variable collections before running the exporter.
- Log the variable ID in the null branch to make orphaned variables traceable.
When it happens
Trigger: Calling getVariablePathString (directly or via path/getBorderWidthAndColor/generateRectangleSnippet/generatePathNodeSnippet/generateTextSnippet) with a variableId that resolves to a variable whose variableCollectionId no longer resolves — e.g. the collection was deleted after variables were detached/modified, or the plugin's figma API session cannot access the collection.
Common situations: Running the Figma inspector plugin on a file where a variable's collection was deleted or the variable was left orphaned; copying node data between files where the variable reference survives but the collection does not; Figma API inconsistencies where getVariableByIdAsync succeeds but getVariableCollectionByIdAsync fails.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Missing resolved data for
- Mode mismatch for variable
- No value found for variable
- Unexpected BOOLEAN value type
- Unexpected FLOAT value type
AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16).
Data as JSON: /api/errors/d2e26bebe172806c.
Report an issue: GitHub.
Appendix: source
Thrown at tools/figma-inspector/backend/utils/property-parsing.ts:367
const variable = await figma.variables.getVariableByIdAsync(variableId);
if (variable) {
const collection = await figma.variables.getVariableCollectionByIdAsync(
variable.variableCollectionId,
);
if (collection) {
const globalName = formatStructName(collection.name);
const pathParts = extractHierarchy(variable.name);
const slintPath = pathParts.map(sanitizePropertyName).join(".");
let resultPath = "";
if (collection.modes.length > 1) {
resultPath = `${globalName}.current.${slintPath}`;
} else {
resultPath = `${globalName}.${slintPath}`;
}
return resultPath;
}
console.warn(
`[getVariablePathString] Collection not found for variable ID: ${variableId}`,
);
}
return null;
}
export async function generateSlintSnippet(
sceneNode: SceneNode,
useVariables: boolean,
): Promise<string> {
const nodeType = sceneNode.type;
switch (nodeType) {
case "FRAME":
return await generateRectangleSnippet(sceneNode, useVariables);
case "RECTANGLE":
case "GROUP":
return await generateRectangleSnippet(sceneNode, useVariables);View on GitHub (pinned to bb937076de)