slint-ui/slint · info

Unknown fill type:

Error message

Unknown fill type:

What it means

getBrush received a fill whose paint type is not one of the handled cases (SOLID, GRADIENT_LINEAR, ...). The default branch warns with the unknown type and returns null, so this fill is skipped in the generated snippet.

Solutions

  1. Extend getBrush with handlers for the missing paint types (e.g. GRADIENT_RADIAL, GRADIENT_ANGULAR, IMAGE)
  2. Pre-filter fills before calling getBrush so unsupported paint types are skipped silently or reported once
  3. Check the Figma plugin/REST API changelog for newly added paint types
  4. Fall back to the nearest supported representation (e.g. average stop color for unhandled gradients) if exact fidelity is not required

Example fix

// before
case "GRADIENT_LINEAR": { ... }
default: { console.warn("Unknown fill type:", fill.type); return null; }
// after
case "GRADIENT_RADIAL":
    return generateRadialGradient(fill);
case "IMAGE":
    return null; // intentionally unsupported
default: {
    console.warn("Unknown fill type:", fill.type);
    return null;
}
Defensive patterns

Strategy: fallback

Validate before calling

const handled = ["SOLID", "GRADIENT_LINEAR"];
if (!handled.includes(fill.type)) { reportUnsupported(fill.type); }

Type guard

function isKnownFillType(t: string): t is "SOLID" | "GRADIENT_LINEAR" {
  return handled.includes(t as any);
}

Try / catch

try {
  brush = getBrush(fill);
} catch (e) {
  brush = fallbackBrushFor(fill);
}

Prevention

When it happens

Trigger: A Figma node's paints include an unhandled type such as GRADIENT_RADIAL, GRADIENT_ANGULAR, GRADIENT_DIAMOND, IMAGE, or a new/unknown paint type returned by the API.

Common situations: Nodes with image fills or radial/angular gradients exported through the snippet generators; Figma adding a new paint type the plugin hasn't been updated to support.

Related errors


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

Appendix: source

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

            }
            return generateLinearGradient({
                opacity: opacity,
                gradientStops: fill.gradientStops,
                gradientTransform: fill.gradientTransform,
            });
        }
        case "GRADIENT_RADIAL": {
            if (!fill.gradientStops || !fill.gradientTransform) {
                return "";
            }
            return generateRadialGradient({
                opacity: opacity,
                gradientStops: fill.gradientStops,
                gradientTransform: fill.gradientTransform,
            });
        }
        default: {
            console.warn("Unknown fill type:", fill.type);
            return null;
        }
    }
}

async function getVariablePathString(
    variableId: string,
): Promise<string | null> {
    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 = "";

View on GitHub (pinned to bb937076de)