# Error Writing to Tag.value:Bad

**URL:** <https://forum.inductiveautomation.com/t/error-writing-to-tag-value-bad/91471>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [June 6, 2024, 12:50pm UTC](https://forum.inductiveautomation.com/t/error-writing-to-tag-value-bad/91471 "2024-06-06T12:50:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PrestonS](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/prestons/32/28432_2.png) [@PrestonS](https://forum.inductiveautomation.com/u/PrestonS)\
**Post date:** [June 6, 2024, 12:50pm UTC](https://forum.inductiveautomation.com/t/error-writing-to-tag-value-bad/91471/1 "2024-06-06T12:50:23Z")

</div>

Hello,  
I have a tag that is giving me this error when I try to toggle it. I have 20 other tags that are setup the same way but this one is not allowing me to toggle it. Attached is a screen shot of the issue. Any help would be greatly appreciated!

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/3/a3a58524e100cde176cab1cbf6040afc00fc22a8.png)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [June 6, 2024, 12:57pm UTC](https://forum.inductiveautomation.com/t/error-writing-to-tag-value-bad/91471/2 "2024-06-06T12:57:16Z")

</div>

Did you by chance try writing to the the tag in a script from the designer? Is it in full read/write communication?

---

<div class="post-metadata">

**Author:** ![PrestonS](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/prestons/32/28432_2.png) [@PrestonS](https://forum.inductiveautomation.com/u/PrestonS)\
**Post date:** [June 6, 2024, 1:01pm UTC](https://forum.inductiveautomation.com/t/error-writing-to-tag-value-bad/91471/3 "2024-06-06T13:01:09Z")

</div>

I am, I am using a gateway script to change the tag. It is the same script for all the tags. It is in full communication.

Here is the script it is just a simple read and set bit command:

#Specifiing the path.  
path = ["[default]Ovens/Oven26/DEKEMA\_Furnace\_Status/OPC\_UA\_DATA\_VisuStatus\_Data"]  
#Tag path  
BitFlipper = ["[default]Ovens/Oven26/IDLE PLC/UnitId 26/26\_013-26\_013/26\_013.value"]

qualifiedValues = system.tag.readBlocking(path)  
value = qualifiedValues[0]  
print path

print value.value

if value.value == "WAIT":  
system.tag.writeBlocking(BitFlipper ,1)  
print("Waiting")

else:  
system.tag.writeBlocking(BitFlipper ,0)  
print("Running")

---

<div class="post-metadata">

**Author:** ![PrestonS](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/prestons/32/28432_2.png) [@PrestonS](https://forum.inductiveautomation.com/u/PrestonS)\
**Post date:** [June 6, 2024, 1:13pm UTC](https://forum.inductiveautomation.com/t/error-writing-to-tag-value-bad/91471/4 "2024-06-06T13:13:44Z")

</div>

I think I found the issue....

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/0/b0cbd5517882534ec5eeaa01a84b88a128f41b89.png)

Now I just need to track down where this issue lies

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [June 6, 2024, 1:15pm UTC](https://forum.inductiveautomation.com/t/error-writing-to-tag-value-bad/91471/5 "2024-06-06T13:15:17Z")

</div>

From looking around the Forum, it seems that this error means that the tag in the device can not be written.

Which appears to have two causes:

1. The address doesn't exist (typo or other entry error).
2. The device is busy doing something else and has refused the write. (Specifically there have been issues seen if this is tried while logic is being updated).

> [@Bad("Bad\_NotWritable: The access level does not allow writing to the Node.")](https://forum.inductiveautomation.com/t/bad-bad-notwritable-the-access-level-does-not-allow-writing-to-the-node/53813/3):
>
> FWIW @Kevin.Herron I’ve been seeing this specifically on 8.1.11 if I’m doing a fairly large logic change and a Logix PLC (not SLC) and then try and write to a tag while the logic changes are currently being accepted. It usually clears up a couple of seconds after the logic has been accepted into the PLC. Same error message.

On another note, I'm going to be honest, I didn't think it was possible to have a tag name that began with a number, even if it is, I would strongly suggest that you don't do that, it will eventually bite you.

If you're running this from a Gateway Script, then `print` doesn't print where you might think.

> [@Event Configuration Print Out to debug](https://forum.inductiveautomation.com/t/event-configuration-print-out-to-debug/60091/5):
>
> It’s complicated slight_smile Starting from most local to least… In the script console, print will log directly to the output buffer on the right hand side. system.util.getLogger() will log to the named ‘Output Console’ Designer window. Bonus: A script invoked from here using system.util.invokeAsync will print to the regular output console, not the buffer on the right hand side. Anywhere else in the designer (except Perspective), print and system.util.getLogger will log to the ‘Out…

For what it's worth, I would write your script like this:

```python
path = ["[default]Ovens/Oven26/DEKEMA_Furnace_Status/OPC_UA_DATA_VisuStatus_Data"]
status = system.tag.readBlocking(path)[0].value
bitFlipper = ["[default]Ovens/Oven26/IDLE PLC/UnitId 26/26_013-26_013/26_013"]
system.tag.writeBlocking(bitFlipper, [if status == "WAIT"])

```

---

<div class="post-metadata">

**Author:** ![PrestonS](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/prestons/32/28432_2.png) [@PrestonS](https://forum.inductiveautomation.com/u/PrestonS)\
**Post date:** [June 6, 2024, 1:20pm UTC](https://forum.inductiveautomation.com/t/error-writing-to-tag-value-bad/91471/6 "2024-06-06T13:20:09Z")

</div>

Thank you Irose!

It was a typo on my end that was looking to the wrong coil. Thank you I will adjust my scripts!
