{"record":{"id":"3b34f806adadda51","repo":"slint-ui/slint","slug":"missing-gradient-stops-for-linear-gradient","errorCode":null,"errorMessage":"Missing gradient stops for linear gradient","messagePattern":"Missing gradient stops for linear gradient","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"tools/figma-inspector/backend/utils/property-parsing.ts","lineNumber":320,"sourceCode":"    gradientStops?: ReadonlyArray<{\n        color: { r: number; g: number; b: number; a: number };\n        position: number;\n    }>;\n    gradientTransform?: number[][];\n}): string | null {\n    const opacity = fill.opacity ?? 1; // Default to 1 if opacity is undefined\n\n    switch (fill.type) {\n        case \"SOLID\": {\n            if (!fill.color) {\n                console.warn(\"Missing fill colors for solid color value\");\n                return \"\";\n            }\n            return rgbToHex({ ...fill.color, a: opacity });\n        }\n        case \"GRADIENT_LINEAR\": {\n            if (!fill.gradientStops || !fill.gradientTransform) {\n                console.warn(\"Missing gradient stops for linear gradient\");\n                return \"\";\n            }\n            return generateLinearGradient({\n                opacity: opacity,\n                gradientStops: fill.gradientStops,\n                gradientTransform: fill.gradientTransform,\n            });\n        }\n        case \"GRADIENT_RADIAL\": {\n            if (!fill.gradientStops || !fill.gradientTransform) {\n                return \"\";\n            }\n            return generateRadialGradient({\n                opacity: opacity,\n                gradientStops: fill.gradientStops,\n                gradientTransform: fill.gradientTransform,\n            });\n        }","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/tools/figma-inspector/backend/utils/property-parsing.ts#L302-L338","documentation":"getBrush found a GRADIENT_LINEAR paint that lacks gradientStops or gradientTransform, so no gradient can be generated. It warns and returns an empty string, producing a blank brush in the exported snippet.","triggerScenarios":"getBrush handles a fill.type === 'GRADIENT_LINEAR' where fill.gradientStops or fill.gradientTransform is missing/empty.","commonSituations":"Gradient paint bound to variables/remote styles the plugin could not fetch; incomplete Figma REST/plugin response; a gradient created with zero stops (degenerate paint).","solutions":["Verify the gradient in Figma has at least one stop and a valid transform, then re-fetch the node","Resolve gradient stops that are bound to color variables before calling getBrush","Re-run export after refreshing the plugin's node data if the response was truncated","Degrade gracefully to a solid color from the first available stop instead of returning \"\""],"exampleFix":"// before\nif (!fill.gradientStops || !fill.gradientTransform) { console.warn(...); return \"\"; }\n// after\nif (!fill.gradientStops?.length) {\n  return fill.color ? rgbToHex(fill.color) : \"transparent\"; // degrade to solid\n}\nconst transform = fill.gradientTransform ?? [[1,0,0],[0,1,0]];","handlingStrategy":"validation","validationCode":"if (fill.type === \"GRADIENT_LINEAR\" && (!fill.gradientStops?.length || !fill.gradientTransform)) {\n  throw new Error(\"Linear gradient missing stops or transform\");\n}","typeGuard":"function hasGradientData(fill: Paint): fill is GradientPaint & { gradientStops: ColorStop[]; gradientTransform: Transform } {\n  return fill.type === \"GRADIENT_LINEAR\"\n    && Array.isArray((fill as GradientPaint).gradientStops)\n    && (fill as GradientPaint).gradientStops.length > 0\n    && Array.isArray((fill as GradientPaint).gradientTransform);\n}","tryCatchPattern":"try {\n  brush = getBrush(fill);\n} catch (e) {\n  brush = firstStopColor(fill) ?? \"transparent\";\n}","preventionTips":["Ensure gradients in the design have at least one stop and a transform","Resolve gradient stops bound to color variables before export","Re-fetch node data if the API response was truncated"],"tags":["figma","gradient","brush"],"backgroundTag":"missing-required-argument","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}