# Error in writing to tags

**URL:** <https://forum.inductiveautomation.com/t/error-in-writing-to-tags/42480>\
**Category:** Ignition\
**Created:** [January 21, 2021, 12:53pm UTC](https://forum.inductiveautomation.com/t/error-in-writing-to-tags/42480 "2021-01-21T12:53:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kp.krishnaprasad97](https://avatars.discourse-cdn.com/v4/letter/k/ac8455/32.png) [@kp.krishnaprasad97](https://forum.inductiveautomation.com/u/kp.krishnaprasad97)\
**Post date:** [January 21, 2021, 12:53pm UTC](https://forum.inductiveautomation.com/t/error-in-writing-to-tags/42480/1 "2021-01-21T12:53:08Z")

</div>

There is a script written in message Handler under gateway events in designer and the message is to update in Tags of type data

 ![Screenshot from 2021-01-21 18-20-16](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/0/a0cee68c432987a1ef3a55d7dd867ad59f144304.png) set but it shows some error  
How to debug the error  
Message and error is attached

---

<div class="post-metadata">

**Author:** ![kcollins](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kcollins/32/19646_2.png) [@kcollins](https://forum.inductiveautomation.com/u/kcollins)\
**Post date:** [January 21, 2021, 1:21pm UTC](https://forum.inductiveautomation.com/t/error-in-writing-to-tags/42480/2 "2021-01-21T13:21:53Z")

</div>

Looks like there is some kind of failure coercing a value at line 30 in your script, specifically `[client]New Tag`… Make sure that if you’re doing a write to a tag that you put the tag path and the value in a list (the function is intended to be able to write to multiple tags). So something like:

```python
# Works, both arguments are Lists
system.tag.writeBlocking(['[client]New Tag'], [1234])
# Does not work, need to have list of tags and list of values
system.tag.writeBlocking('[client]New Tag', 1234)
```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 21, 2021, 2:23pm UTC](https://forum.inductiveautomation.com/t/error-in-writing-to-tags/42480/3 "2021-01-21T14:23:04Z")

</div>

Among other things, you can’t access client tags from the gateway…

---

<div class="post-metadata">

**Author:** ![kp.krishnaprasad97](https://avatars.discourse-cdn.com/v4/letter/k/ac8455/32.png) [@kp.krishnaprasad97](https://forum.inductiveautomation.com/u/kp.krishnaprasad97)\
**Post date:** [January 22, 2021, 5:13am UTC](https://forum.inductiveautomation.com/t/error-in-writing-to-tags/42480/4 "2021-01-22T05:13:30Z")

</div>

Tag Path is correct  
I tried by making arguments of tag path and data as List  
but Tag is not updated  
No error is found

 ![Screenshot from 2021-01-22 10-22-29](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/e/4e15a36def0e5f92f4d4ce0821c6ea59e32337ea.png) ![Screenshot from 2021-01-22 10-22-57](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/5/451c55fbaf9ee0a678b456b630cae259ad065574.png)  
Data is loaded into the logger  
Is there any method to write to Tag through Message Handler in Gateway event scripting

---

<div class="post-metadata">

**Author:** ![kp.krishnaprasad97](https://avatars.discourse-cdn.com/v4/letter/k/ac8455/32.png) [@kp.krishnaprasad97](https://forum.inductiveautomation.com/u/kp.krishnaprasad97)\
**Post date:** [January 22, 2021, 5:15am UTC](https://forum.inductiveautomation.com/t/error-in-writing-to-tags/42480/5 "2021-01-22T05:15:43Z")

</div>

So how can I store data in tags for further processing in Message Handler

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 22, 2021, 2:16pm UTC](https://forum.inductiveautomation.com/t/error-in-writing-to-tags/42480/6 "2021-01-22T14:16:17Z")

</div>

You can’t. Pass everything you will need in the payload. If you need a return from the gateway message handler, you must use `.sendRequest()` instead of `.sendMessage()` and use the return value.

The key point is that client tags exist independently in each client–local to the client. The gateway has no access to any client’s local scope. Including the variables in jython and gui windows or components–they are independent in every client. Every bit of information that needs to pass from client to gateway or vice versa must use some form of messaging. Regular tags are the core tool for this, with specific data types. Messages are the generic tool, allowing any serializable data type.
