# MQTT Publish Error

**URL:** <https://forum.inductiveautomation.com/t/mqtt-publish-error/46072>\
**Category:** Maker\
**Created:** [April 27, 2021, 4:20pm UTC](https://forum.inductiveautomation.com/t/mqtt-publish-error/46072 "2021-04-27T16:20:43Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![wes0johnson](https://avatars.discourse-cdn.com/v4/letter/w/7ab992/32.png) [@wes0johnson](https://forum.inductiveautomation.com/u/wes0johnson)\
**Post date:** [May 5, 2021, 4:38pm UTC](https://forum.inductiveautomation.com/t/mqtt-publish-error/46072/7 "2021-05-05T16:38:14Z")

</div>

Ah - I think I see what is happening. I think you probably have not scoped your custom namespace subscription in MQTT Engine narrowly enough. MQTT Engine sees the publishes occurring from the device, presumably on a topic like this:

```auto
deviceId/relay/0

```

But, you are publishing on a topic like:

```auto
deviceId/relay/0/command

```

I would guess you have a subscription for the custom namespace something like one of these or some other subscription that results in you getting both of these messages back and MQTT Engine:

```auto
deviceId/#
deviceId/relay/#

```

You could fix this by scoping the topic subscription of the custom namespace to exclude the command messages. For example, something like either of these would work.

```auto
deviceId/+/+
+/+/+

```

I don’t know the full set of topics you may want to subscribe to so you may need to adjust this. The real issue here is that MQTT Engine sees the command topic and tries to add the new tag(s) to the tag tree. But, a leaf tag already exists above this path and it fails with this error message. So, by limiting the topic subscription it would prevent MQTT Engine from ever seeing those (and it doesn’t really need to anyway).

---

_[View the full topic](https://forum.inductiveautomation.com/t/mqtt-publish-error/46072)._
