# Error on writing to tag associated with enum

**URL:** <https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492>\
**Category:** Ignition Early Access\
**Created:** [May 6, 2020, 5:59pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492 "2020-05-06T17:59:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [May 6, 2020, 5:59pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/1 "2020-05-06T17:59:26Z")

</div>

My PLC is setted up like this

mode: AS0153\_TRIM\_PRESS\_MODE;

TYPE AS0153\_TRIM\_PRESS\_MODE :  
(  
(\*  
Mode in which the press will aim to reach a state where physical access ;  
this may (or may not) require human intervention depending on the case  
_)  
stop\_and\_secure := 0,  
(_  
Normal run mode. Loading may be automatic or manual : see relevant  
configuration variable for more information.  
_)  
run := 10,  
(_  
Set-up mode. Allows tool to be put on the press and clamped.  
_)  
setup := 20,  
(_  
Expert (maintenance) mode allowing control of individuel actions.  
\*)  
expert := 99  
);  
END\_TYPE

When I try to write value to my tag I got an error… My tag is Integer.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/981283fd37c879053b662c2c9f670f7c3ff9a81e.png)

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 6, 2020, 10:12pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/2 "2020-05-06T22:12:49Z")

</div>

Maybe someone will recognise what you’re referring to, but for the rest of us, what PLC are you talking about?? I haven’t seen enums used in any of the PLCs we use (then again, I’m also not a PLC guy)

Also, how is your tag configured in Ignition? (screenshot?)

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [May 6, 2020, 10:14pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/3 "2020-05-06T22:14:47Z")

</div>

We code with CODESYS. We are now in test, so we use CODESYS SOFTPLC.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/1e07406aad80f868442432e66e55673154d484ac.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 6, 2020, 11:12pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/4 "2020-05-06T23:12:29Z")

</div>

Does this happen if you write to it in the Quick Client?

In the Ignition Gateway find the logger(s) for OpcUaConnection and set them to TRACE and then write again.

It might also help to get a Wireshark capture after changing the SecurityPolicy of the OPC UA connection to None.

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [May 7, 2020, 12:24pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/5 "2020-05-07T12:24:01Z")

</div>

> [@Kevin.Herron](#):
>
> Quick Client

I have activate log trace on OPCuaConnection, nothing append when I try to write.

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [May 7, 2020, 12:31pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/6 "2020-05-07T12:31:52Z")

</div>

Same problem in Quick client…

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

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 7, 2020, 12:52pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/7 "2020-05-07T12:52:14Z")

</div>

You may need to call support then. There should be messages in the gateway logs when the write happens (after turning the logger to TRACE).

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [May 8, 2020, 10:49am UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/8 "2020-05-08T10:49:07Z")

</div>

I have tried with UA Expert and all works great. I got too my list of enumeration. My datatype in my enumeration is short. Does Ignition can support enumaration like UA Expert ?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 8, 2020, 12:30pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/9 "2020-05-08T12:30:44Z")

</div>

Ignition does support enum values from OPC UA but it won’t list the symbolic name for each member. They are integer values when used in Ignition OPC tags.

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [May 8, 2020, 12:32pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/10 "2020-05-08T12:32:55Z")

</div>

Why I unable to write to it?

I don’t need the list, only the values.

Why I can read but not write?

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

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 8, 2020, 12:38pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/11 "2020-05-08T12:38:12Z")

</div>

I don’t know. Turning that logger to TRACE should have logged something in the gateway logs.

If you can get a Wireshark capture of the write instead I can take a look at that. The connection has to using SecurityPolicy None while capturing.

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [May 8, 2020, 1:17pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/12 "2020-05-08T13:17:40Z")

</div>

Hope is it what you need…

[test.zip](https://forum.inductiveautomation.com/uploads/short-url/z8558KFXuNRzpmsWfOi4WpEGKtV.zip) (42.8 KB)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 8, 2020, 1:54pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/13 "2020-05-08T13:54:35Z")

</div>

I don’t see any OPC UA traffic in the capture.

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [May 8, 2020, 2:18pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/14 "2020-05-08T14:18:56Z")

</div>

Will retry…

How can I be sure capture I send you contains OPC UA traffic?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 8, 2020, 2:27pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/15 "2020-05-08T14:27:27Z")

</div>

Are you running Wireshark on the machine with the Ignition gateway installed?

The capture should contain traffic between the gateway IP and PLC IP on port 4840 or whatever other port the OPC UA server is running on.

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [May 8, 2020, 2:33pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/16 "2020-05-08T14:33:13Z")

</div>

Everything runs on same machine… (Wireshark, Ignition, PLC)

This time I have recorded loopback traffic

[test2.zip](https://forum.inductiveautomation.com/uploads/short-url/k0KKoNZJFecFPKP5Ll0iJi7fgJD.zip) (619.1 KB)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 8, 2020, 2:40pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/17 "2020-05-08T14:40:18Z")

</div>

Okay, it’s failing because the server returns Bad\_TypeMismatch when Ignition writes an Int32 value.

The server reports the DataType as identified by NodeId `|type|CODESYS Control Win V3 x64.amt_machine_30.AMT_AS0153.AS0153_TRIM_PRESS_MODE`, so need to figure out what underlying DataType that resolves to.

If possible, can you browse in UaExpert under `Types > DataTypes > BaseDataType`, and start looking for this Node? You mentioned it’s an Enumeration, so I’d expect to maybe find it under the `Enumeration` Node somewhere. If you can find it a screenshot of the browse hierarchy in UaExpert will be useful.

Also, if you can use Wireshark to capture the successful write from UaExpert that may provide a useful comparison.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 8, 2020, 2:53pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/18 "2020-05-08T14:53:16Z")

</div>

Hmm, actually I have a guess at what might be wrong. The WriteRequest from Ignition includes a StatusCode in the value, which many servers do not support. It’s strange that the error reported is Bad\_TypeMismatch but possible.

That the StatusCode is included with the value is a bug that only happens if coercion to the target datatype fails. There must be some problem reading the DataType tree from this server or using it to resolve the target type.

Turning these loggers to TRACE may yield more information:

- com.inductiveautomation.ignition.gateway.opcua.client.connection.OpcUaClient
- com.inductiveautomation.ignition.gateway.opcua.client.connection.DataTypeTree
- com.inductiveautomation.ignition.gateway.opcua.util.Conversions

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [May 8, 2020, 3:17pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/19 "2020-05-08T15:17:45Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/650cf350ddc871e501922eecbbc0f27eab49efa9.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 8, 2020, 3:21pm UTC](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492/20 "2020-05-08T15:21:40Z")

</div>

What version of Ignition are you using? There should have been a message from the Conversions logger in between those 2. I can’t really see any reason for this not working right now though.

[Next page](https://forum.inductiveautomation.com/t/error-on-writing-to-tag-associated-with-enum/34492.md?page=2)
