# Something curious happen with an Exported/Imported flow

**URL:** <https://discourse.nodered.org/t/something-curious-happen-with-an-exported-imported-flow/54375>\
**Category:** General\
**Created:** [27 November 2021 16:13 UTC](https://discourse.nodered.org/t/something-curious-happen-with-an-exported-imported-flow/54375 "2021-11-27T16:13:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![xytsrm](https://avatars.discourse-cdn.com/v4/letter/x/6de8d8/32.png) [@xytsrm](https://discourse.nodered.org/u/xytsrm)\
**Post date:** [27 November 2021 16:13 UTC](https://discourse.nodered.org/t/something-curious-happen-with-an-exported-imported-flow/54375/1 "2021-11-27T16:13:10Z")

</div>

CONTEXT: Running some test flows between two PC's.

PC1: MQTT Broker with several clients; Client 1 sends messages to Client 2. Clients 1 & 2 very simple five node groups

Exported Client 1 as JSON file and Imported it to PC2.  
While the connection of Client 1 on PC1 remained stable, the connection of Client 1 on PC2 kept connecting and disconnecting.

Confirmed that the WiFi connection on PC2 was strong.  
Disabled Client 1 on PC2, and rebuilt it exactly from scratch on PC2, the connection now remained stable.

Any suggestions as to why the imported Client 1 on PC2 failed to maintain a stable connection, and the rebuilt Client 1 was stable?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [27 November 2021 16:22 UTC](https://discourse.nodered.org/t/something-curious-happen-with-an-exported-imported-flow/54375/2 "2021-11-27T16:22:18Z")

</div>

Have they both got unique client id's set in the mqtt node configuration?

---

<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:** [27 November 2021 16:40 UTC](https://discourse.nodered.org/t/something-curious-happen-with-an-exported-imported-flow/54375/3 "2021-11-27T16:40:36Z")

</div>

If you copy/paste a flow and you have provided a Client ID in the mqtt broker config then you wll end up with two systems using the same Client ID, which causes the problem you are seeing. Unless you have a good reason then leave the client id blank and node-red will allocate it for you and you will not have this problem.

---

<div class="post-metadata">

**Author:** ![xytsrm](https://avatars.discourse-cdn.com/v4/letter/x/6de8d8/32.png) [@xytsrm](https://discourse.nodered.org/u/xytsrm)\
**Post date:** [27 November 2021 16:41 UTC](https://discourse.nodered.org/t/something-curious-happen-with-an-exported-imported-flow/54375/4 "2021-11-27T16:41:06Z")

</div>

Actually, you reminded me of something I needed to check. I guess the question is would the Client ID be preserved when imported to PC2, or be given a unique ID by the Broker on the first connection from PC2?

Colin, answered the question the Client ID must have been in conflict; the Broker doesn't automatically assign a new ID.

---

<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:** [27 November 2021 16:43 UTC](https://discourse.nodered.org/t/something-curious-happen-with-an-exported-imported-flow/54375/5 "2021-11-27T16:43:09Z")

</div>

Are you saying that the id is blank in the flow you imported?

---

<div class="post-metadata">

**Author:** ![xytsrm](https://avatars.discourse-cdn.com/v4/letter/x/6de8d8/32.png) [@xytsrm](https://discourse.nodered.org/u/xytsrm)\
**Post date:** [27 November 2021 16:45 UTC](https://discourse.nodered.org/t/something-curious-happen-with-an-exported-imported-flow/54375/6 "2021-11-27T16:45:47Z")

</div>

Colin, you answered the question. I was working on the assumption the Broker would assign a new ID when Client 1 was imported to PC2 and deployed.

---

<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:** [27 November 2021 16:48 UTC](https://discourse.nodered.org/t/something-curious-happen-with-an-exported-imported-flow/54375/7 "2021-11-27T16:48:01Z")

</div>

I don't think it is the broker that allocates an id. If you leave it blank then (I think) the MQTT node allocates an id (probably when it is deployed, but have not checked). If you provide a client id in the config then neither node-red or the broker can change that.  
You still have not said whether, where you see the problem, you have provided an id in the config or left it blank.

---

<div class="post-metadata">

**Author:** ![xytsrm](https://avatars.discourse-cdn.com/v4/letter/x/6de8d8/32.png) [@xytsrm](https://discourse.nodered.org/u/xytsrm)\
**Post date:** [27 November 2021 16:50 UTC](https://discourse.nodered.org/t/something-curious-happen-with-an-exported-imported-flow/54375/8 "2021-11-27T16:50:08Z")

</div>

I just checked the JSON file, it has it's original ID, it's not blank.

> [@Colin](#):
>
> (I think) the MQTT node allocates an id (probably when it is deployed

I would have though that the Broker kept track (clearing-house) of all the ID's to prevent conficts.

---

<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:** [27 November 2021 16:53 UTC](https://discourse.nodered.org/t/something-curious-happen-with-an-exported-imported-flow/54375/9 "2021-11-27T16:53:10Z")

</div>

You didn't need to check the file, just look in the config node. So you (or someone else) told the node to use that id, causing the problem. I just wanted to confirm that this was the problem and not that an auto-generated id is getting exported/imported. So leave it blank and you should not have a problem.

---

<div class="post-metadata">

**Author:** ![xytsrm](https://avatars.discourse-cdn.com/v4/letter/x/6de8d8/32.png) [@xytsrm](https://discourse.nodered.org/u/xytsrm)\
**Post date:** [27 November 2021 16:53 UTC](https://discourse.nodered.org/t/something-curious-happen-with-an-exported-imported-flow/54375/10 "2021-11-27T16:53:50Z")

</div>

Got it thanks., I didn't have Node-RED opened at the time that's why I just did a quick check in the JSON file. 😀

---

<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:** [26 January 2022 16:54 UTC](https://discourse.nodered.org/t/something-curious-happen-with-an-exported-imported-flow/54375/11 "2022-01-26T16:54:34Z")

</div>

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