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

**URL:** <https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541>\
**Category:** General\
**Created:** [1 June 2021 08:00 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541 "2021-06-01T08:00:38Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![avinash-choudhary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/avinash-choudhary/32/42659_2.png) [@avinash-choudhary](https://discourse.nodered.org/u/avinash-choudhary)\
**Post date:** [1 June 2021 08:00 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/1 "2021-06-01T08:00:38Z")

</div>

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?

 ![Screenshot 2021-06-01 at 1.29.41 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/b/eb79e6f5e4e8a8a3f99ee14143f69b7cf1fc81d9.png)

 ![Screenshot 2021-06-01 at 1.28.40 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/a/4affb35a5824742afa327975f0f464e4507be1ae.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 June 2021 20:44 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/2 "2021-06-01T20:44:42Z")

</div>

Welcome to the forum @avinash-choudhary

> [@avinash-choudhary](#):
>
> 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

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.

---

<div class="post-metadata">

**Author:** ![avinash-choudhary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/avinash-choudhary/32/42659_2.png) [@avinash-choudhary](https://discourse.nodered.org/u/avinash-choudhary)\
**Post date:** [2 June 2021 05:38 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/3 "2021-06-02T05:38:19Z")

</div>

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 .

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2021 06:36 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/4 "2021-06-02T06:36:10Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![avinash-choudhary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/avinash-choudhary/32/42659_2.png) [@avinash-choudhary](https://discourse.nodered.org/u/avinash-choudhary)\
**Post date:** [2 June 2021 07:29 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/5 "2021-06-02T07:29:22Z")

</div>

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.

 ![Screenshot 2021-06-02 at 12.57.31 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/0/90dea5dd5e49a765f771e6a78aa17bde2859f197.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 June 2021 07:50 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/6 "2021-06-02T07:50:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![avinash-choudhary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/avinash-choudhary/32/42659_2.png) [@avinash-choudhary](https://discourse.nodered.org/u/avinash-choudhary)\
**Post date:** [2 June 2021 07:53 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/7 "2021-06-02T07:53:05Z")

</div>

Hi @Colin

Ya got it , thanks for your inputs .

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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 June 2021 10:31 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/8 "2021-06-02T10:31:26Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![avinash-choudhary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/avinash-choudhary/32/42659_2.png) [@avinash-choudhary](https://discourse.nodered.org/u/avinash-choudhary)\
**Post date:** [7 June 2021 05:54 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/9 "2021-06-07T05:54:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 June 2021 07:40 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/10 "2021-06-07T07:40:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![avinash-choudhary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/avinash-choudhary/32/42659_2.png) [@avinash-choudhary](https://discourse.nodered.org/u/avinash-choudhary)\
**Post date:** [7 June 2021 08:45 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/11 "2021-06-07T08:45:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 June 2021 08:53 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/12 "2021-06-07T08:53:25Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/e/ae48d7ce8711b02e72263957d3544cada88014d6.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 June 2021 09:08 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/13 "2021-06-07T09:08:10Z")

</div>

> [@avinash-choudhary](#):
>
> If i load 10 flow files

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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [7 June 2021 09:37 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/14 "2021-06-07T09:37:10Z")

</div>

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

```auto
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

```

---

<div class="post-metadata">

**Author:** ![avinash-choudhary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/avinash-choudhary/32/42659_2.png) [@avinash-choudhary](https://discourse.nodered.org/u/avinash-choudhary)\
**Post date:** [17 June 2021 04:56 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/15 "2021-06-17T04:56:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![avinash-choudhary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/avinash-choudhary/32/42659_2.png) [@avinash-choudhary](https://discourse.nodered.org/u/avinash-choudhary)\
**Post date:** [17 June 2021 06:08 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/16 "2021-06-17T06:08:03Z")

</div>

Hi @dceejay

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

 ![Screenshot 2021-06-17 at 11.37.02 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/e/ee8180e7145582081dfc877ec7f9cddc6b17ead3.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [1 July 2021 06:08 UTC](https://discourse.nodered.org/t/serial-port-cannot-open-error-tracking-with-flow-id-or-name/46541/17 "2021-07-01T06:08:21Z")

</div>

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