Troubleshooting

OPC UA won't connect? The 6 usual causes

Almost every "OPC UA client can't connect" case comes down to one of six things: the wrong endpoint, a blocked port, a security-mode mismatch, an untrusted certificate, bad credentials, or a node-access problem. Work down this list in order and you'll fix the large majority of failures.

First move: reproduce the connection with a known-good reference client such as UaExpert from the same machine and network segment as your gateway. If UaExpert connects and your app doesn't, the problem is in your app/config, not the server.

1. Wrong endpoint URL

The endpoint must be exactly right, including scheme, host and port:

opc.tcp://192.168.10.20:4840        # correct
opc.tcp://plc-server:4840/UADiscovery
http://192.168.10.20:4840           # wrong scheme
192.168.10.20                        # missing scheme/port
  • Use the server's routable IP or resolvable hostname, not localhost unless you're on the server.
  • Confirm the endpoint is reachable from the actual gateway location, not just an engineering laptop.
  • Some servers advertise a hostname the client can't resolve: try the IP explicitly.

2. Port blocked / firewall

OPC UA binary usually runs on TCP 4840 (servers may differ). A TCP timeout or "connection refused" is almost always network/firewall:

# is the port open from where the client runs?
nc -vz 192.168.10.20 4840
# or
Test-NetConnection 192.168.10.20 -Port 4840   # PowerShell

If that fails: open the port on the server/OS firewall, check VLAN/routing, and confirm no NAT is rewriting the address the server advertises.

3. Security-mode mismatch

Client and server must agree on a security policy and mode (None, Sign, or Sign&Encrypt). If the client asks for a policy the server doesn't offer (or vice-versa), the handshake fails. List the server's endpoints first and pick a matching one.

Testing with SecurityMode = None is fine to isolate a problem, but never leave production on None.

4. Certificate not trusted (the most common)

With Sign or Sign&Encrypt, the client and server swap X.509 certificates and each must trust the other. A first connection typically fails because the client's certificate is sitting in the server's rejected folder (and/or vice-versa).

  1. Attempt the connection once (it will be rejected).
  2. On the server, move the client's certificate from pki/rejected to pki/trusted/certs.
  3. On the client, trust the server's certificate when prompted.
  4. Reconnect.

Also check the certificate hasn't expired and that its application URI matches. Full detail: OPC UA security & certificates.

5. Bad or missing credentials

If the server requires user authentication, an anonymous connection will be refused. Confirm whether it expects anonymous, username/password, or a user certificate, and supply the right one.

6. Node access & expectations

You're connected but reads/writes fail? Confirm the node list is complete and stable, and clarify up front whether the requirement is read-only or the client is expected to write: write access is often restricted and must be enabled explicitly.

Quick checklist

SymptomMost likely cause
Connection refused / timeoutPort/firewall (#2) or wrong endpoint (#1)
"BadSecurityChecksFailed" / handshake errorCertificate trust (#4) or mode mismatch (#3)
"BadIdentityTokenRejected"Credentials (#5)
Connect OK, read/write failsNode access / permissions (#6)

Which status code points to which cause?

Read the status code your client logs before changing anything. Each code below points to one of the six causes, so you can skip straight to the right fix. The links open our page for that code with its usual causes and checks.

Status codeWhat it means in practiceGo to
BadConnectionRejectedNothing is listening on that host and port, or a firewall refused the connectioncause #2
BadTcpEndpointUrlInvalidThe endpoint URL, usually its path, is not one the server servescause #1
BadTcpMessageTypeInvalidA peer received a transport message it does not accept; often a reverse-connect setup on one side onlycause #1
BadSecurityPolicyRejectedThe server does not offer, or has disabled, the policy you asked forcause #3
BadSecurityModeRejectedThe server refuses the security mode you asked for on that endpointcause #3
BadCertificateUntrustedThe peer certificate is not in the trusted storecause #4
BadCertificateTimeInvalidThe certificate has expired or is not yet valid, or a clock is wrongcause #4
BadCertificateUriInvalidThe ApplicationUri does not match the URI in the certificatecause #4
BadCertificateHostNameInvalidThe host you dialled is not in the server certificatecause #4
BadSecurityChecksFailedA generic security verification failure, most often a trust problemcause #4
BadSecureChannelClosedThe secure channel was closed by a peer or the socket droppedcause #2
BadIdentityTokenRejectedWrong or refused user credentialscause #5
BadUserAccessDeniedAuthenticated, but the user may not do this on that nodecause #6
BadNotWritableThe node does not allow writes for this usercause #6
BadNodeIdUnknownThe server has no such node; often a shifted namespace indexcause #6

Questions engineers ask

Why does UaExpert connect but my application does not?

The two clients are not configured the same way. Compare the endpoint, security policy, security mode and user token each one uses, then check the server's rejected certificate folder: your application has its own certificate, which the server must trust separately from UaExpert's.

Which port does OPC UA use?

TCP 4840 is the registered default port for opc.tcp, but many servers listen on another port. Read the port from the endpoint URL the server advertises or from its configuration, and open only that port between the client and the server.

How do I fix BadCertificateUntrusted?

Connect once so the certificate is rejected, then move it from the rejected folder to the trusted folder on the side that refused it. Check that the certificate is in date and that its ApplicationUri matches, then reconnect.

Can I just use SecurityMode None?

Only to isolate a fault on a test network. If the connection works with None and fails with Sign or SignAndEncrypt, the problem is security configuration or certificate trust. Put production back on SignAndEncrypt.

Get the free OPC UA connection checklist

A printable one-pager of these checks in order: keep it by the panel for the next commissioning.

Get the free checklist →

Last updated 1 December 2026 · Educational resource.

Free download
OPC UA Troubleshooting & Integration Checklist
The field-tested checklist engineers use to diagnose certificates, ports and namespace problems fast, plus a Python (asyncua) client template.
Get the free checklist →
Free, no course, no login