slint-ui/slint · warning

[generatePathNodeSnippet] Could not extract path commands…

Error message

[generatePathNodeSnippet] Could not extract path commands from SVG for node:

What it means

generatePathNodeSnippet converts a Figma VECTOR node into a Slint Path snippet. It extracts the node's SVG data and matches the `d` (path commands) attribute with a regex. When the match fails — no `d` attribute or an empty command list — this warning is logged and the generated snippet contains a placeholder comment instead of the commands property.

Solutions

  1. Recreate or repair the vector node in Figma so it contains actual path geometry (check the node in Figma's vector edit mode).
  2. Flatten/re-export the node: use Figma's Flatten command or re-draw the shape, then regenerate the snippet.
  3. If the shape should be simple, replace the VECTOR with a RECTANGLE/ELLIPSE so a non-path snippet is generated.
  4. Keep the generated `// Could not extract path commands from SVG` placeholder and fill in `commands:` manually from the SVG source.

Example fix

// generated snippet (before)
Path {
    // Could not extract path commands from SVG
}
// after (manually supply commands from the SVG)
Path {
    commands: "M 0 0 L 10 0 L 10 10 Z";
    fill: #000000;
}
Defensive patterns

Strategy: validation

Validate before calling

const svg = sceneNode.type === 'VECTOR' ? await (sceneNode).exportAsync({ format: 'SVG_STRING' }) : null;
const d = svg?.match(/d="([^"]*)"/)?.[1];
if (!d) console.warn(`Node ${sceneNode.id} has no path commands; snippet will contain a placeholder`);

Type guard

function hasPathCommands(node: SceneNode): node is VectorNode {
    return node.type === 'VECTOR';
}

Prevention

When it happens

Trigger: Calling generatePathNodeSnippet (via generateSlintSnippet on a node of type VECTOR, or the snippet command) on a vector node whose vectorNetwork/svg data has no parsable `d` attribute — e.g. an empty vector, a vector with only fills/strokes but no path geometry, or an SVG payload shape the regex doesn't expect.

Common situations: Inspecting Figma files with flattened boolean operations that produced empty path data; vector nodes created from images or plugins that have no real path commands; copy-pasting or exporting SVG in an unexpected format.

Related errors


AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16). Data as JSON: /api/errors/d1afbd27a44075ef. Report an issue: GitHub.

Appendix: source

Thrown at tools/figma-inspector/backend/utils/property-parsing.ts:781

                        );
                    }
                    break;
                case "commands":
                    if (sceneNode.type === "VECTOR") {
                        try {
                            const svgString = await sceneNode.exportAsync({
                                format: "SVG_STRING",
                            });
                            const match = svgString.match(
                                /<path[^>]*d=(["'])(.*?)\1/,
                            );
                            if (match && match[2]) {
                                const pathCommands = match[2];
                                properties.push(
                                    `${indentation}commands: "${pathCommands}";`,
                                );
                            } else {
                                console.warn(
                                    "[generatePathNodeSnippet] Could not extract path commands from SVG for node:",
                                    sceneNode.id,
                                );
                                properties.push(
                                    `${indentation}// Could not extract path commands from SVG`,
                                );
                            }
                        } catch (e) {
                            console.error(
                                "[generatePathNodeSnippet] Error exporting SVG for node:",
                                sceneNode.id,
                                e,
                            );
                            properties.push(
                                `${indentation}// Error exporting SVG: ${e instanceof Error ? e.message : e}`,
                            );
                        }
                    }

View on GitHub (pinned to bb937076de)