Function node issues: Invalid Properties - noerr (Chrome) & closing editor while in Setup or Close tab

My function node shows an error (red triangle) with a tooltip:

Invalid Properties

I've seen a similar issue with an IE browser, but I'm using the latest Chrome on Windows and this will NOT go away even though there are no errors or warnings in the editor itself.

I've managed to narrow this down to a missing closing brace } for a conditional inside a function defined in the function node's code ... however the editor didn't show any issues with that so maybe you can improve the visual indicator for any such unpaired braces so other users don't struggle with this weird -noerr issue :wink:

One annoying thing that I found in the editor is a warning about a misplaced ? in the following code:

return condition
    ? 'true'
    : 'false';

It insists that the ? must be on the same line as the return statement or condition, which is completely incomprehensible when I look at

return condition ?
    'true' :

(my code is actually much longer, condition is complex and the two statements are also longer so both the ? and : get lost at the end of long lines!

Also, when I switched the editor tabs from Function to either Setup or Close then hit Done, my Chrome DevTools stopped with a JavaScript error (no error if I leave it with the Function tab active when hitting Done):

TypeError: Cannot read property 'getTokens' of null

this is in getTokens() called from:

  • $renderLine()
  • $renderChanges
  • _flush()
  • schedule()
  • setAnnotations()
  • onChangeAnnotation()
  • r._signal()
  • setAnnotations()
  • clearAnnotations()
  • (anonymous) - inside ace.define("ace/mode/nrjavascript", [], ...)
  • r._signal()
  • terminate()
  • $stopWorker()
  • destroy()
  • destroy()
  • disposeEditor()
  • oneditsave()
  • click()
  • ...

Can you post the function node with the missing brace that caused the problem please? Use the </> button at the top of the forum edit window when pasting it in.

Also post a function node containing the code with the failing conditional statement please.

Please make each one a complete function node so we can paste it in and test.


Here's a simple function with a missing closing } which shows an error triangle and tooltip with Invalid properties: - noerr reference:

if( msg.topic === 'start' ) {

return msg;


And here's a function with the conditional that shows a warning triangle in the editor (on the line with ? - Bad line breaking before '?'), but works just fine.

node.warn( msg.topic === 'start'
    ? 'starting...'
    : 'other...'
return msg;

Yes, I see those too. I don't think this is a node-red issue as it uses the ACE editor if I remember rightly which I believe also does the syntax checking. I don't know where one would report such issues.

We have just updated to the latest version of ACE in git and it appears to handle the code sample you've shared properly:

The noerr thing is an artefact of how we are able to pass errors between the ACE syntax highlighting/validation and the editor. It isn't ideal, but we don't have any other way to flag up such issues once the edit dialog is closed and the ACE editor no longer exists.

Does the new one show an error in the editor for the missing brace? It doesn't show anything at the moment, only on the node itself after closing the editor.

Ah good point. No it doesn't - but that's an issue with us, not ACE.

Because the code you put inside the Function node is actually the body of an async function, before we pass it up to ACE to validate, we wrap it in a function:

So when you have the following in the edit box:

if( msg.topic === 'start' ) {

return msg;

We actually pass this to ACE to validate:

async function __nodered__(msg) {
   if( msg.topic === 'start' ) {

   return msg;

This stops it warning if you use await in your function code.

However, it means in the case you've highlighted, it considers the bracket for the if statement to have a closing bracket (the one we add), and the bracket that isn't closed is actually on the first line. That puts the warning on the first line and we hide it because it's out of range of your code.

That doesn't stop the count of errors to be correct (noerrs === number of errors) - which is why the node is (correctly) marked as invalid, despite nothing showing in the edit dialog.

So need to be a bit smarter about handling errors that get flagged on the first (added) line.

So, how is ACE flagging this as an error or how exactly do you "hide" the first and last line from being displayed?
Perhaps you can catch that "invisible" ACE error and indicate it to the NR user somehow, within the Function editor?
The -noerrs is very confusing and very hard to find as the user doesn't know what they're looking for - my example was very short, but it took me a while (binary search - deleting blocks of code) to find the missing brace :frowning:

@pitus I know what needs to be done - I was just reporting back to @Colin that the scenario he had raised was an extra issue that needed handling.

You can see the fix here:

In summary, it ensures all errors are visible to the user in the edit dialog and in the case of the missing { error, it attempts to move the error to the right line in the code.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.