StatusCode
In OPC UA, a StatusCode is a 32-bit numeric result carried by every service response, operation result and DataValue. Its upper bits give the severity - Good, Uncertain or Bad - and identify the specific condition; its lower bits carry info flags such as the subscription queue overflow bit and the limit bits.
Severity is the first thing to branch on
Every symbolic name starts with Good, Uncertain or Bad, and that prefix is the whole contract for a consumer. Good means use the value. Uncertain means the value exists but the server is telling you not to trust it, as with UncertainSensorNotAccurate or UncertainEngineeringUnitsExceeded. Bad means there is no usable value, as with BadNoCommunication or BadDeviceFailure. Application code should switch on severity and only then look at the specific code for diagnostics and logging.
Code bits and flag bits
The value splits into two halves. The code bits are the value masked with 0xFFFF0000 and identify the condition; the flag bits are the value masked with 0x0000FFFF and carry additional information, including the DataValueInfo bits, the limit bits and the overflow bit. A concrete consequence documented in OPC Publisher: the value 1152, which is 0x480, is DataValueInfo combined with the overflow bit, and its code bits are zero, so it looks up as Good. A data-loss condition can therefore be reported as Good unless you inspect the low half.
Where StatusCodes appear
There are three distinct layers. The service-level ServiceResult in the response header fails the whole call, for example BadTooManyOperations. The per-operation results array carries one StatusCode per requested item, so a Read of ten nodes can return nine Good and one BadNodeIdUnknown. The DataValue StatusCode is the data quality of an individual value. Confusing the first with the second is why clients report a total failure when only one node was wrong.
Encoding, and the JSON zero
Good is numerically zero. In UA Binary a StatusCode is a plain UInt32. In JSON encoding a zero StatusCode is omitted, so a DataValue with no StatusCode member is a Good value, not an incomplete record. Some encodings additionally carry a Symbol string alongside the numeric code for human readability; treat the numeric code as authoritative.
Example
Splitting a StatusCode into code bits and flag bits - the overflow case documented in the OPC Publisher notes
raw = 1152 (0x00000480)
codeBits = raw & 0xFFFF0000 -> 0x00000000 -> Good
flagBits = raw & 0x0000FFFF -> 0x00000480 -> DataValueInfo | Overflow
reads as "Good" while telling you the server dropped notifications
Defined in: Part 4 - Services, Annex on StatusCodes; Part 8 - Data Access for quality semantics.
Last verified 7 September 2026 against OPC UA 1.05.07. OPC UA Connect is an educational resource and is not affiliated with the OPC Foundation.