Uncaught (in promise) RuntimeError: function signature mismatch

Running pretty much any asynchronous code will result in the error:

Uncaught (in promise) RuntimeError: function signature mismatch

Is my env setup wrong? I’ve gone through three brand new project setups and get this error every time. Has anyone else faced this issue?

For context: I have an async function at the root of my project plugin code, even running
await new Promise(resolve => setTimeout(resolve, 1000)); will result in the error.

As far as I can tell the code will keep running, as long as it doesn’t rely on the asynchronous piece.

The error will only happen on the return from the await-ed funciton.

Please advise.

Do you have figma.closePlugin() in the end of code? Maybe it runs before the async function finishes if it’s outside?

1 Like

Just verified that close plugin is not called before the plugin exits, but that’s a good suggestion.

Do you know if it might be something else?

Are you loading any fonts by any chance? figma.loadFontAsync is known for throwing this error, although I don’t remember why.

@Nikita_Jerschow Did you solve this problem in the end?

I had the same issue and solved it with “await”.
I called “figma.loadFontAsync” in an async function, but I didn’t add the “await” statement when calling that function. So adding the “await” solved the problem for me.

Maybe just a problem with Figma runnig over a longer time?

2 Likes

Also think so. After restarting the desktop application, the error disappeared.

1 Like

Thanks, it helped me too!