IMDTouchKnowledge BaseShop main store

Troubleshooting

Why WinCC synchronous writes get an invalid OPC item handle

HMI and touchscreens Published 8 min read By IMDTouch engineering team

Short answer

The failing write reached the OPC server and was rejected there because WinCC attached item handle 0x0000, which no server ever issued for that group. DCOM, accounts and the network are already proven by the server's own log. Re-register the items and keep the group intact; check data types only after a write is accepted.

On this page
  1. Read the two log lines as one event
  2. Why this is not a DCOM problem
  3. How an item handle goes invalid
  4. Hold every input constant except the client
  5. Fix the WinCC side in this order
  6. Where the data format actually fits
  7. The decision for each outcome
  8. Questions asked

The write is reaching the OPC server, and the server is rejecting it because WinCC attached item handle 0x0000 to the request — a handle the server never issued and cannot resolve to any item. That is what the two log lines say: the request arrived, the group exists, and the reference to the item inside the group is empty. The log also settles the DCOM question. A write that gets logged and answered on the server has already passed the network, activation and access checks that the working test client suggested. Fix WinCC's item registration and group lifecycle first; leave DCOM alone and keep data types for last.

Read the two log lines as one event #

Both lines carry the same timestamp, 26/08 13:52:28, so one synchronous write produced both:

26/08 13:52:28 : OPC : Synchronous write error for group 'Schneider-Aut_OFS_2' : Invalid handle : 0x0000
26/08 13:52:28 : OPC : Error : item write error (c0040001h) for deleted (group Schneider-Aut_OFS_2)

Decode each field:

  • Operation: a synchronous write. WinCC waited on the server's answer, which is why the server's own result appears verbatim in its log — the most legible mode for diagnosing this fault.
  • Group: Schneider-Aut_OFS_2. The group exists on the server and the failure happens inside it, so connection setup succeeded.
  • Handle: 0x0000. A server issues a nonzero handle of its own for every item it accepts into a group, and this server calls 0x0000 invalid. Zero is not a stale handle left behind by a removed item — a removed item leaves a real number behind. It is the value a client carries when no item was ever successfully registered for the tag.
  • Result: c0040001h. As an unsigned 32-bit number that is 3221487617: 0xC0040001 = 0xC0000000 + 0x00040001 = 3221225472 + 262145 = 3221487617. The leading C marks a failed result, and the 0001h portion is the OPC Data Access code for an invalid item handle — the same meaning as the server's plain words on the line above.
  • Name slot: deleted. The server looked the handle up in its group, found no item, and printed its placeholder word where an item name belongs.

Every field points the same way: the write carried no valid item reference. The PLC address, the value and the wire were never consulted.

Why this is not a DCOM problem #

The decisive question for any failed OPC write is whether the request reaches the server. This one does. The server records the synchronous write and answers with its own result code, so the transport, the COM activation and the access checks are all behind the failure point. DCOM faults look different: the client gets an access-denied or server-creation failure, no group is created, and nothing OPC-level is logged. Changing activation and access permissions cannot fix a write that already arrives — it can only break an access path that currently works.

If you ever meet the other case, where a write never arrives at all, the checks for an OPC DA client against a third-party OPC server are the right tool, and that article on third-party OPC server DCOM failures walks them.

The Schneider test client working on the WinCC computer adds one fact: this machine can host a working OPC session to the server. It adds nothing about WinCC's items, because a session, its groups and its handles belong to the client process that created them and nothing carries over. And matching local administrator account names on the two computers changes nothing here: identity matters when a request is refused before OPC processing, and this request was processed.

How an item handle goes invalid #

A client receives server handles only at add-items time, and a handle stays usable only inside the group that issued it, only while that group lives. The events that leave a client writing on an empty or dead reference:

  • add-items failed or never ran — a bad item ID or a rejected item leaves the tag with no handle at all;
  • the item was removed from the group, by the client or by server policy after a connection drop;
  • the group was deleted and recreated — handles die with the group, and the client must re-add its items;
  • the connection dropped and was rebuilt while the client kept its old item references;
  • the server process restarted, destroying every handle it had issued.

The intermittent addressing error in WinCC is the same fault seen from the tag list. When the channel cannot validate or hold an item at the server, that tag's quality drops and WinCC reports an addressing error; when a retry registers the item, quality returns. One tag flickering while its neighbors stay healthy points at that item's registration. Many tags flickering together points at the group or the connection being rebuilt. Match the flicker timestamps against the server log's add, remove and connection lines, and the pattern names the layer.

The dependency behind that list — a write only lands when the item reference behind it is valid and current — is not WinCC-specific. Transaction-group writes that only work with a valid custom index show the same rule in a different client.

Hold every input constant except the client #

Before comparing clients, pick a test variable that cannot actuate anything, and write a value that is harmless if it lands. Then run the identical synchronous write from both clients and hold these constant:

What to hold constant What to record What a difference means
Server destination The server computer and server program ID each client connects to Two different servers make the comparison meaningless
Item ID The exact item string each client writes, taken from the server's own browse A spelling or access-path difference puts the fault on one client alone
Write access The read and write capability the server reports for that item A read-only item fails writes in both clients and points at the server mapping
Operation An actual write of the same value, then a read-back A successful read proves only the read path
Timing The log order of add, remove, reconnect and write Writes after a group rebuild land on dead references

The decision falls out of the table: if the test client fails on the identical item, the fault is the item mapping or its write rights at the server, not in WinCC. If the test client succeeds while WinCC fails on the same item, the fault is WinCC's item registration and lifecycle, and the sequence below is the fix.

Fix the WinCC side in this order #

  1. Rebuild the connection. Delete and re-create the WinCC channel connection that names the server computer and the server program ID, then re-create the tags on it. A fresh connection forces the runtime to perform a new add-items instead of reusing stored item state.
  2. Take each tag's item address from the server's own browse — the exact string the working test client used — and enter it character for character. Do not retype it from a document or copy it from another project.
  3. Confirm on the server that the item accepts writes. A read-only item reads correctly and fails every write, which mimics half of this fault.
  4. Watch one write end to end. The server log must show the item added to the group, then the write accepted. If the log shows the add failing, stop there: the item ID is wrong, and no later step matters until it registers.
  5. Keep the group intact. Do not let the channel remove and re-add items every cycle, and do not tear the group down on a single failed operation. After any drop, confirm successful re-adds in the log before writes resume.
  6. Keep the write mode synchronous until writes are accepted, then set the mode the application needs. Many OPC client drivers run asynchronous writes by default and keep synchronous as the diagnostic choice.

A synchronous write is the legible mode here because the call returns the server's own result, so the invalid-handle rejection appears at the moment it happens. The same rejection on an asynchronous write arrives later, in a completion callback, and looks like a tag that silently never updates. One fix covers both.

Where the data format actually fits #

A data-format mismatch cannot produce this error. The server resolves the handle to an item before it reads any value, so a wrong type shows up as a conversion rejection, a wrong value or an unexpected sign — with the write accepted and the handle valid. The suggestion to move the tag from BCD to INT or WORD belongs after the sequence above, once a write lands. Then compare three things: the WinCC tag type, the item type the server reports, and the PLC variable's declared type, treating INT and WORD as different in signedness. Check byte order only when a good-quality read returns a value that is wrong in a consistent way. The write-lands-but-value-is-wrong case is its own diagnosis, and why an HMI writes the wrong PLC value above 9 walks through it.

The decision for each outcome #

  • The server logs the write with the zero handle, and the test client writes the same item successfully: rebuild WinCC's connection and tags so add-items succeeds, and leave DCOM untouched.
  • Both clients are rejected on the identical item: fix the item mapping or its write rights at the server; WinCC is not the fault.
  • Writes are accepted but values are wrong: move to data types, then byte order, in that order.
  • Writes are accepted and the addressing error still flickers: correlate the flicker with connection drops in the log. Flicker tied to drops is re-registration behavior after a rebuild; flicker during steady operation means item churn continues and the channel configuration still needs work.

The two lines — a synchronous write rejected because the item the server cannot name carries no valid handle — are the whole fault. The fix lives where the handle should have been created: in WinCC's item registration.

Questions asked

Does the word deleted in the server log mean a tag was removed somewhere?

No. Deleted sits in the item-name slot of the server's log line: the server looks the write's handle up in the group, finds no item behind it, and prints the placeholder where a name belongs. Nothing was deleted in WinCC, in the server configuration or in the PLC. What is missing is the reference itself, the handle-to-item binding a server issues when an item is added to a group.

Can the test client and WinCC share one server session and its handles?

No. Every client process that connects to an OPC server gets its own session, its own groups and its own item handles. A handle issued to the test client is meaningless inside a WinCC write, and a handle from one session used in another produces exactly the invalid-handle result in the log. Success in one client never transfers to the other; each must register its own items.

What should be sent when this is escalated to the server vendor?

Send both log lines with their shared timestamp, the group name, the exact item ID configured on the failing WinCC tag, and the write mode in use. Add what the server's own test client does when it writes the same item. That set lets the vendor tell in one exchange whether the handle left the client empty or was invalidated on the server side.

Why does the addressing error appear only some of the time?

Quality follows the item's state at the server. While the channel holds a validated item, the tag reads good; when validation fails or the item drops out of the group, quality goes bad and WinCC shows the addressing error. A later retry that re-adds the item turns the tag good again without any write taking place, so the state flickers with the item's registration history.

Keep reading

  • Explainer

    Why an OPC DA viewer can't be a bridge endpoint: WinCC tag access

    A bridge copies values between OPC servers, and a client-only viewer exposes no server interface, so it can never be selected as provider or consumer. Restrict the viewer at the server instead: from WinCC V7.5, per-tag OPC write protection and OPC read protection bind every client of the WinCC OPC server, and a SIMATIC NET OPC server offers variable selection, aliases and per-item read and write rights for controller data.

    HMI and touchscreens

  • Troubleshooting

    When WinCC OPC UA browsing works but runtime gets no values

    Successful tag browsing and installed certificates prove only that WinCC reached the bridge's address space. Commission the link as four boundaries — upstream data into the bridge, the OPC UA session, the tag mapping, runtime updates — with one known test item, and stop at the first boundary that fails; it names the fix.

    HMI and touchscreens

  • How-to

    Keeping WinCC on S7-1500 furnaces when a supplier pushes its own SCADA

    Keep WinCC as a written requirement in the purchase specification, with the edition, the license owner and the source-project deliverables named. Give the S7-1500 a symbolic interface over OPC UA so the SCADA stays replaceable without PUT/GET access. Accept a supplier-built platform only when it passes written documentation, reference and license checks.

    HMI and touchscreens

Why the HMI image updater login fails with invalid_request