Skip to content

Troubleshooting

Ralf Steinert edited this page Nov 2, 2026 · 1 revision

Connecting

no connection or a refused connection. Is opcua-sim serve running, and on that port? The default is 4840; if it is taken, serve stops with an error and --port chooses another one.

It works on the same machine, but not from another one or from a container. By default the server binds to loopback. Use --host 0.0.0.0 and name the address clients should use with --endpoint-host, because many clients follow the endpoint URL the server returns. The control channel is then reachable too, and it has no authentication, so do this on a network you trust.

no answer in time. Is a delay or blackhole fault still set? opcua-sim list shows the faults, and opcua-sim clear server removes them.

An encrypted endpoint refuses your client. With security: [encrypt] there is no endpoint without encryption, so the client needs a certificate of its own. The server does not check client certificates. Its own certificate is self-signed and new at every start, so a client that pins it will refuse the next run.

A user is refused, or anonymous cannot write. With users in the bench, anonymous clients may read but not write, and role viewer may only read.

Node IDs

BadNodeIdUnknown. The most common cause on the Siemens layout is missing quotes, because ns=3;s="DB_Line"."Speed" includes them. In a shell, wrap the whole ID in single quotes. opcua-sim browse and opcua-sim map <profile> show the exact IDs.

The namespace index is different. Do not hardcode it. Look it up by URI, as real servers may change the order. On the generic profiles the URI is urn:steitec:opcua-sim.

this server has its own node IDs. The short form pump.Speed only exists on the generic profiles. Use the full form on a product profile.

method must be device.Method, or use --object. OPC UA calls a method on an object. For the full form of a method ID, name the object: opcua-sim call 'ns=4;i=7002' --object 'ns=4;i=5001'.

Values and writes

read_value() raises instead of returning. asyncua raises on a Bad status. Use read_data_value(raise_on_bad_status=False) to see the status.

BadTypeMismatch. The variant type must match exactly. Speed on the PLC profiles is Float, like a Siemens Real, while on the drive profile it is Double.

BadNotWritable or BadOutOfRange. opcua-sim map <profile> marks writable variables with rw. Limits come from min and max in the profile.

The source timestamp does not move. It only changes when the value or status changes, and an unchanged value is not published again. A constant value is not a frozen one.

A value is back after you wrote it. A model may recalculate it. opcua-sim set forces a value from outside, and null hands it back to the simulation.

Alarms

No alarm events arrive. Subscribe on the Server object or the device node, with a type filter that includes the alarm: OffNormalAlarmType for discrete alarms, ExclusiveLevelAlarmType for level alarms. Events only come when a state changes. For alarms that are already active, call ConditionRefresh.

BadEventIdUnknown. Acknowledge with the EventId of the latest event of that condition. Each change makes a new one.

A level alarm does not clear when the value returns. deadband keeps it active until the value is clear of the limit by that much. A variable with a Bad status does not change the alarm at all.

Enable, Disable, AddComment, Confirm or shelving do not work. They are not implemented. Alarms are events with Acknowledge and ConditionRefresh, not full condition instances.

Tests

Tests take long. Each server takes about a second to start. Keep a bench for a group of tests in a fixture with a wider scope if your tests can share it.

Pytest fails on Windows with ResourceWarning: unclosed transport. See Testing in CI.

A restart takes longer than downtime. Building the server adds about a second. Use bench.wait_restarted().

Still stuck? Open an issue with opcua-sim -v serve ... output.

Clone this wiki locally