Troubleshooting
Why OPC UA writes fail while reads stay good
Short answer
Good reads prove only the read path. A write rejected as 0x80004005 is a generic failure, not a permission verdict: read the node's AccessLevel and UserAccessLevel under the session's real identity, check the write bit, then split bridge from source with a direct OPC UA write.
On this page
A write that dies while every read returns good quality is not a transport fault and not yet a permission verdict: it is an upstream rejection nobody has identified. The logged code 0x80004005 is the generic COM/Windows failure value (E_FAIL) a client stack reports when an operation fails without a more specific result; it names no resource and proves no permission problem. What decides the write sits on the node: AccessLevel states what the node supports, UserAccessLevel states what the connected user may do, and the server checks the session's user against the node before it accepts any value. Read both attributes under the driver's real identity, decode the write bit, then split bridge from source with a direct UA write to the same node. If the user's write bit is missing, the fix lives in the upstream server's role assignment; if it is present, chase the value and the tag mapping.
What the log line already proves #
The write attempted from KEPServerEX's own Quick Client died in the upstream hop. The entry that reached the KEPServerEX log names the operation (an asynchronous write), the node (ns=3;s=1510:IMIS.TAG1.Value), the device (WWChannel.Wonderware), and it ends with callback item error 0x80004005. Because the message comes from the OPC UA Client driver, the component that speaks to the upstream server, the rejection happened at or beyond that server; the Quick Client hop accepted the write and passed it downstream, so spend no time there.
The good reads clear the transport question on their own: reads and writes share one session and one connection, so a firewall or endpoint fault would break both together. Disabling the firewall changed nothing, which is what this diagnosis predicts. Put the approved policy back and work on the write-specific checks.
Reads and writes are authorized separately #
Good quality on a read proves the session, the subscription and the path to the node, nothing about the right to change it. A UA session carries one authenticated user from activation onward; the server evaluates that user's roles against each node's permissions, and read and write are judged separately, so a node can serve perfect reads to a user whose writes it never accepts. The read/write setting on the tag in each program only permits an attempt through that layer; it grants nothing on the server upstream.
A previous OPC DA path that wrote fine proves just as little: it ran under different software with different user contexts, and none of its permissions carry across to the UA session. The chain here has two hops, the Quick Client to KEPServerEX and then the driver to the upstream server, each a client-server pair with its own authenticated user. That layering, and why the server that answers your client is not the server that owns the tag, is the same one described in where an OPC UA server sits when Python reads PLC data. The identity that matters is the user the driver's connection activates with, not the Windows account running the configuration tool.
The attributes that decide the write #
OPC UA Part 3, the address-space specification, gives every variable two attributes that decide this. AccessLevel is the node's capability. UserAccessLevel is that mask filtered for the session's current user, and both use the same bit layout for read and write: bit 0 (value 1) is Read, bit 1 (value 2) is Write, so read plus write decodes as 3.
The server builds UserAccessLevel from the user's roles and the node's permissions; section 4.9.3 of Part 3, on evaluating permissions with roles, sets out that evaluation, and a user whose roles carry no Write permission is denied on a node that is writable for others. The server evaluates the user when the session is set up, so a role change takes effect after the client reconnects. A worked UserAccessLevel check for node write permission walks the read-and-decode step, and how role permissions combine across session roles covers how the server combines them.
Checks in order #
Work through these on the existing connection before rebuilding anything; the working reads are an asset.
- Record the session identity: the user name the driver's connection activates with at the upstream endpoint. Every permission decision runs against that account, not against the Windows login on the configuration PC.
- Connect a general OPC UA test client to the same endpoint URL with those same credentials, browse to the failing node, and read its AccessLevel and UserAccessLevel.
- Decode the write bit of UserAccessLevel with the AND test in the worked example below. Bit present: permission is not the verdict. Bit absent: grant the user's role Write on the node through the server's documented user administration, then reconnect and repeat.
- Write one plain, valid value of the node's datatype directly from the test client, then the same value through KEPServerEX. Different outcomes put the fault in the bridge.
- If both writes fail identically, open the upstream server's own write diagnostics for your timestamp and read the specific status it returned.
Write tests only on a tag whose value no actuator follows: a test write that moves a live command can start or stop equipment.
Worked example: decode the write bit #
Suppose the test client returns these attribute values for the failing node; both numbers are examples, so read your own from the browse result.
| Attribute | Example value | Decode |
|---|---|---|
| AccessLevel | 3 | 3 = 1 + 2: Read and Write, so the node itself accepts writes |
| UserAccessLevel | 1 | 1 = bit 0 only: Read, so this user may not write |
The permission test is one AND operation, UserAccessLevel AND 2. With UserAccessLevel 1: 1 AND 2 = 0, no write bit for this session's user, so the server refuses every write regardless of what any client-side tag claims. The correction is at the server: assign that user a role carrying Write permission on the node, reconnect so the session picks up the new role, and repeat the same write.
With UserAccessLevel 3 instead: 3 AND 2 = 2, the write bit is present, permission is cleared, and the plain-value write and the direct comparison take over.
Split the bridge from the source #
Compare the same node, the same value and the same identity across the two clients.
| Observed result | The fault sits at | Next move |
|---|---|---|
| The direct write fails too | The upstream server or its source | Read that server's write status for your timestamp and confirm the underlying tag is writable at all |
| The direct write succeeds, the write through KEPServerEX fails | The KEPServerEX hop | The driver's session identity differs from the test client's, or the tag address does not match the browsed NodeId; re-point the tag by browsing |
| Both writes succeed | The write path is healthy | Re-examine the original write's value: datatype, scalar versus array, or content the source rejects |
Match the submitted value to the node's DataType before testing anything clever: a plain value of the declared type first, boundary values and strings afterwards. A value the node cannot hold fails in a way that looks identical to a denial while all you can see is the generic code.
The decision #
- Write bit absent in UserAccessLevel: the session's user lacks Write on the node. Fix the server's role assignment for that user, reconnect, and re-test. No client-side setting changes this outcome.
- Write bit present, direct write succeeds, the write through KEPServerEX fails: the bridge is at fault. Re-browse the upstream address space, re-map the tag to the exact NodeId, and confirm the driver's connection uses the credentials you tested.
- Write bit present and the direct write fails too: the upstream server or its source refuses the write. Read the server's write result at your timestamp and confirm the underlying tag accepts writes rather than being a calculated or feedback value.
- In every branch, the logged code only posed the question; the decoded attributes and the direct write give the verdict.
Questions asked
Does 0x80004005 always mean a permission denial?
No. It is the generic failure value a Windows-side client stack reports when an operation dies without a more specific result. The server returns its own status on a write, for example Bad_UserAccessDenied for a user without the write bit, Bad_NotWritable for a node that cannot accept writes at all, or Bad_TypeMismatch for the wrong value type. A test client that displays the service status, or the server's own log, names the real cause.
Why did turning the firewall off change nothing?
Transport was never the suspect: reads traverse the same TCP session as the failing writes and return good quality. A firewall or endpoint problem breaks the session as a whole, so you would lose reads, subscriptions and browsing together. Restore the approved firewall policy and spend the time on the write-specific checks instead.
Which user does the write session actually present?
The credentials are part of the UA client driver's connection configuration for that channel: endpoint URL, security policy, and the user name and password the session activates with. The upstream server's own session diagnostics list the connected user, which is the authoritative answer. Compare that user against the role that carries write permission on the failing node.
The write bit is set and a direct write still fails. Now what?
The user is authorized, so the cause is value or mapping. Send a plain valid value of the node's datatype first, for example the integer 1 on a numeric tag, before testing strings or boundary values. If a plain value is still refused, browse the server again and re-map the tag to the exact NodeId, because a mistyped identifier fails with the same generic error.