Uncaught Error in widget

I am working on a widget and it appears to work correctly, but in the console I get this: Uncaught Error: “Expected rectangle fill network when generating indiv borders network” in generateFillableStrokeNetworkFromFillNetwork (FGNodeHelpers.cpp)

This is the only indication that something is wrong, because in both desktop app and Chrome, it functions as expected.

I can’t figure out the issue. If I step through the code, the error happens during the render.

Here is the render code in case it helps. I’d appreciate any insight because I’ve stared at this and I can’t spot the issue. I can provide the rest of the code if necessary

const { widget } = figma
const { useSyncedState, AutoLayout, Text } = widget

function Widget() {

  // code removed for clarity. The issue seems to happen during render

  return (
    <AutoLayout
      direction={'horizontal'}
      verticalAlignItems={'center'}
      horizontalAlignItems={'center'}
      width={170}
      spacing={8}
      padding={16}
      cornerRadius={8}
      fill={'#FFFFFF'}
      stroke={'#333333'}
      onClick={handleClick}
      tooltip={'Click to toggle flag visibility'}
    >
      <Text fontSize={26}>{flagsVisible ? 'Hide' : 'Show'}</Text>
      <Text fontSize={26}>flags</Text>
    </AutoLayout>
  )
}

widget.register(Widget)

This error comes from the Figma’s rendering engine, not from the plugin/widget API. It doesn’t mean that something is wrong with your code. Just an internal issue.

1 Like

Thank you for your reply. I’ll stop worrying about it.