Troubleshooting
Why system.opc.read fails when run on the main gateway
Short answer
A system.opc.read call on the main gateway fails because the function looks the connection name up in the OPC connection list of the gateway executing the script, and the OPC-COM connection exists only on the Edge gateway; nothing relays the call across the gateway link. Run the script on the Edge gateway, or create a second OPC-COM connection on the main gateway with its own DCOM and firewall settings.

On this page
The call fails because of where it runs, not because of how it is written. A system.opc.read call resolves the OPC connection name against the gateway that executes the script, so a connection that exists only on the Edge gateway can never be read from a script that the main gateway runs. Nothing relays the call across the gateway link. The tags you read fine through the same link arrive by a separate route, the Edge tag provider feeding the main gateway, which is why the symptom looks contradictory. You have two fixes: run the script on the Edge gateway and reuse the DCOM session that already works, or create a second OPC-COM connection on the main gateway with its own DCOM and firewall settings. The checks below put you in the right case, and the closing section gives the decision for each.
What the call actually resolves #
A system.opc call takes the name of an OPC server connection and the address of an item in that server's namespace. The manuals document the single-value read as system.opc.readValue; whichever spelling your installed version uses, the lookup behaves the same way. The gateway executing the script looks the connection name up in its own OPC connection list, on the gateway's configuration pages under OPC Connections > Servers, the same place where connections are created. That list is per-gateway configuration: the main gateway's list contains only connections defined on the main gateway, an Edge gateway connection is simply not in it, and no documented setting forwards a system.opc call from one gateway to the other. The failure happens at name resolution, before any packet is sent toward the OPC server host, which is why the error comes back immediately and says nothing useful about the server itself.
Why the tags work but the call fails #
The DCOM session to the OPC server belongs to the Edge gateway process, and the main gateway holds none of its own. Tag values take a different road: the Edge gateway reads the server over its own session, feeds its tag provider, and that provider shares the tags to the main gateway over the link described in pulling Ignition Edge tags to the main gateway with a remote tag provider. Compare the two paths for the same value:
| Path | Hop sequence | Result |
|---|---|---|
| Tag read on the main gateway | Edge gateway reads the server over its DCOM session, feeds its tag provider, provider shares the tag over the Edge-to-main link | Works |
system.opc.read from a main gateway script |
Main gateway looks the connection name up in its own list and finds nothing | Fails at the lookup |
system.opc.read from an Edge gateway script |
Edge gateway resolves its own connection and reads over its existing DCOM session | Works |
The table is also the diagnostic: tags from that connection working on the main gateway while the direct call fails is the signature of the scope case, not of broken DCOM.
Checks, in order #
- Identify the gateway that executes the script. A script stored in a gateway's own configuration, such as a gateway timer script, runs on that gateway; a script that travels with a project runs on the gateway serving that project.
- On that gateway's configuration pages, open
OPC Connections > Serversand look for the exact connection name the call passes. A name absent on the main gateway but present on the Edge gateway confirms the scope problem. - A connection present on the executing gateway but showing faulted is a different fault: work the DCOM layers in the fix-two table below instead.
- A connection present and connected on the executing gateway points at the call itself: check the item address against the server's browse tree and print the returned quality code, because a Bad quality on a plausible value points at the DCOM path or the address.
- Only when the connection name is missing on the executing gateway do you take one of the two fixes below.
Fix one: run the call where the connection lives #
This is the lower-risk fix: the DCOM session already works on the Edge gateway and no new network path opens. Decide by who consumes the value:
- Edge-local logic, or a client served by the Edge gateway: run the script on the Edge gateway and reference the connection name exactly as the Edge gateway's connection list spells it. Nothing else changes.
- Main-gateway logic needs the value: create a tag for the item on the Edge gateway and consume it over the existing Edge-to-main link. A tag is a continuous subscription, not a one-off read, so for a parameter needed only occasionally set a slow subscription rate, once a minute for example, to keep the load on the OPC server flat instead of bursty. When the consuming logic should react to the value rather than poll it, the pattern for running central tag event scripts on remote Edge tags is the fitting mechanism.
Placement matters on the Edge gateway: put the logic where it runs without a Designer session. If the relocated script stops whenever the Designer closes, that lifecycle trap has its own write-up at why gateway scripts stop when the Ignition Edge Designer closes.
Fix two: give the main gateway its own connection #
If main-gateway code must perform true on-demand reads or browse, it needs its own OPC-COM connection to the same OPC server, created under OPC Connections > Servers on the main gateway. DCOM is a per-client-machine arrangement: the launch and access permissions granted on the OPC server host for the Edge host do not carry over to the main gateway host, and neither do its firewall rules. Test the layers in order, physical first:
| Layer | Test from the main gateway host | A failure means |
|---|---|---|
| IP reachability | Ping the OPC server host | Routing or VLAN block; stop here |
| Endpoint mapper | TCP 135 open to the OPC server host | Firewall blocks DCOM activation, so nothing downstream will work |
| Dynamic RPC ports | The RPC dynamic port range configured on the OPC server host is open from the main gateway host, Windows default range 49152-65535 | The connection starts, then times out or faults at activation |
| DCOM permissions | In dcomcnfg on the OPC server host, the main gateway's service account holds launch/activation and access permission on the server's DCOM entry |
Access denied errors on connect |
| Server licensing | Check the OPC server's concurrent-client limit | The second client is refused even with correct DCOM settings |
If the OPC server host is a third machine, run every test from the main gateway host specifically; a pass from the Edge host proves nothing about the main host.
Worked example, sizing the firewall change for fix two: the main gateway host needs the endpoint mapper port, TCP 135, plus every port in the server host's RPC dynamic range. A Windows host at defaults assigns that range from 49152 through 65535, so the allow rule set covers 65535 - 49152 = 16383, plus one for counting both endpoint ports, which is 16384 TCP ports on top of TCP 135. Fix one adds none of this, because the Edge host's session and rules keep working untouched. If a 16384-port open range is unacceptable on the server segment, have the range narrowed to a smaller configured block on the server host and open exactly that block: the range is a configurable setting, and the Windows default is not a requirement.
Confirm the fix #
Run the relocated script once and print the returned value and quality code to the console of the gateway that executes it. Compare the value against the same item read in the OPC server's own test client or in the Edge gateway's tag browser: the two must match, with a good quality code on both. Then prove the call is hitting the live server instead of a cached answer: stop or disconnect the OPC server briefly, repeat the call, and confirm the quality code comes back Bad. A call that still returns a plausible value with a good quality code is not reading the server you think it is.
The decision #
- Connection only on the Edge gateway, script on the main gateway, value consumed near the machine: run the script on the Edge gateway.
- Main-gateway logic needs the value: create an Edge tag and read it over the existing link, with a slow subscription rate for a rarely used parameter.
- Main-gateway code genuinely needs on-demand reads or browse: add the second OPC-COM connection once the DCOM layers pass from the main gateway host, with the server host's dynamic port range narrowed to a block your firewall policy accepts.
- Connection present and connected on the executing gateway but the call still fails: verify the item path against the server's browse tree and watch the quality code.
Whatever the path, treat the call as a diagnostic read: a value that protects people or equipment is evaluated in the PLC's own logic, never fetched by an opportunistic script.
Questions asked
Do OPC writes and browse calls have the same gateway scope?
Yes. The system.opc family documented in the manuals covers reading, writing and browsing OPC server connections, and every call in it resolves the connection name against the gateway that executes the script. A write or a browse from the main gateway to an Edge-only connection fails the same way a read does, and the two fixes are the same: run the call where the connection lives, or add a second connection on the main gateway.
Why does the item path in the call differ from my tag path?
The call reads the OPC server directly, so it wants the connection name plus the item address exactly as the server's own browse tree shows it, for example an address like Channel1.Device1.Tag1. An Ignition tag path with a provider prefix belongs one layer above, in tag reads and tag subscriptions, not in this call. Taking the item address from the tag browser instead of the server browse tree produces the same failed call from a different cause.
The script already runs on the Edge gateway and still fails. What next?
Then the scope explanation is ruled out. Check three things: the connection name string in the call matches the Edge gateway's OPC connection list exactly, including spelling and case; the connection shows as connected on the Edge gateway's status page; and the item path matches the OPC server's browse tree. Print the returned quality code with the value, because a Bad quality code on a plausible value points at the DCOM path rather than the script.
Can the main gateway forward a system.opc call to the Edge gateway over the gateway network connection?
No. The gateway network connection carries the tag data configured to share between the two gateways; it does not expose the remote gateway's OPC connections or its scripting functions. No documented setting relays a system.opc call from one gateway to another. If main-gateway code needs the value, share the item as a tag over that link or give the main gateway its own OPC connection.


