Serial Port Cannot Open Error Tracking with Flow (ID or Name)

Hi Team

I am having two flows

  1. Flow - Using COM1
  2. Flow - Using COM2

But by COM2 is down or disconnected , an error is displayed in Terminal/Command console : ([error] serial port COM3 error: Error: Error: No such file or directory, cannot open COM3)

But the Error Message above does not mention any flow name / flow id .

Is there a way where we can map the error / uncaught exception with Flow name /Flow id/ Node id?

Welcome to the forum @avinash-choudhary

If you use the search feature (Ctrl+F) and search for COM1 then it should take you to the node.

For the future please, where possible, copy/paste text here rather than taking a screenshot.

Hi @Colin

I am trying to keep the com port down or disconnected . So that i can see the error in terminal or command or logs.

I wanted to map the error with flow
So i need a solution to add flow related information in Error logs .

If you add a Catch node linked to the serial node and feed it into a debug node set to show Complete Message (that is important) what do you see in the debug pane?

Hi @Colin

I tried the catch approach but since its a uncaught Exception type its not reaching catch node . The debug node attached t0 catch node does not give any data.

It isn't an uncaught exception or it would crash node-red, but you are right that it does not generate an error that can be caught by a Catch node. I don't know you can solve your problem. Perhaps someone else can suggest something.

1 Like

Hi @Colin

Ya got it , thanks for your inputs .

Ya would be grateful if any one can help me with this .

Hi - not sure I've caught up - but what exactly is the problem ? It says it can't open COM1 - so you need to fix that . Is there some other app already using it ? Is it actually physically there on that machine ? Do you just need to remove the config node that the serial port is using - or edit it to point to a serial port that does exist ?

Hello @dceejay

The issue is not about the serial port connection , we have deliberately disconnected the Serial port . What we need is the error that is getting displayed in command / terminal / error logs Should be trackable with the flow.

For Example -

  1. COM1 is in Flow 1
  2. COM2 is in Flow 2

If COM2 is disconnected , command / terminal / error logs Shows the error COM2 is down or disconnected , but there is no information of flow if or flow name for tracking .

We need it for tracking since we may have 10 flows and 1 flow fails then we need to send the issue to the End User

I think you may be misinterpreting the error. It is not saying that there is nothing connected to the port externally, it is saying that node red cannot connect to the port, so either the serial hardware does not exist or the node red user does not have permission to use it, or something else is already using it.
I think the error will never occur at run time, only when starting node red or deploying. For that reason you cannot catch it in the flow as the flow is not running when the error occurs.

Ya correct @Colin
The error is during load or reload of flow file. So is there a way to print flow id in logs. If i load 10 flow files and one of it has COM2 and COM2 is not connected , then can i get the Flow name or id in the logs

The message comes from a serial port config that can be on one or more flows.

Is it not enough to just search CTRL+F for COM1?

image

How are you loading multiple flow files? A single node-red instance only runs one flow file.

I have added a small fix to the node (v0.14.1) that also prints out the serial config node id - eg

7 Jun 10:24:02 - [error] [serialconfig:e18d2fe3.a499b] serial port /dev/com1 error: Error: Error: No such file or directory, cannot open /dev/com1
2 Likes

Hi @dceejay
Thanks for the update , will check this one.

Hi @dceejay

Thanks for the help
The Serial port node id is now displayed in logs .

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