Status code · Data access

BadIndexRangeInvalid

BadArrays

BadIndexRangeInvalid means the IndexRange string you supplied is malformed or cannot apply to that attribute. IndexRange uses zero-based start:end with commas between dimensions, for example 2:5 or 0:3,1:2. Check the syntax, the dimension count against ArrayDimensions, and that you are not applying a range to a scalar.

Defined behaviour: The syntax of the index range parameter is invalid, or the index range cannot be applied to the value of the attribute being read or written. (our description of the condition this code reports)

What you actually see

A Read or Write that includes an IndexRange fails immediately, while the same request without the IndexRange succeeds and returns the whole array.

Why it happens

  • Malformed range stringIndexRange is a string, not a structure, and servers parse it strictly. A one-based index, a hyphen instead of a colon, a space around the colon, a reversed range where the start exceeds the end, or a trailing comma all produce this code rather than a helpful parse error. Indexes are zero-based and both bounds are inclusive.
  • Wrong number of dimensionsA range for a multidimensional array needs one entry per dimension, comma separated, in the order given by ArrayDimensions. Supplying 0:3 for a two-dimensional value, or 0:3,0:3 for a one-dimensional value, is an invalid range even though each part is syntactically legal.
  • IndexRange applied to a scalar or to a non-array attributeIf the node's ValueRank is -1 the value has no dimensions to index. The same applies to attributes that are not arrays. Some clients attach a default IndexRange to every read in a batch, which then fails on exactly the scalar members of that batch.
  • Range applied to a ByteString or String expecting element semanticsServers may allow indexing into a ByteString or String as an array of bytes or characters, and may not. Where the server does not support it, a syntactically valid range on such a node is rejected as inapplicable rather than as out of data.
  • Partial array write where the server only accepts whole-array writesWriting with an IndexRange asks the server to splice values into an existing array. A server backed by a PLC tag that can only be written whole may reject any IndexRange on Write while accepting it on Read, which makes the failure look intermittent and direction-dependent.

How to fix it

In diagnostic order: work down, do not skip ahead.

  1. Drop the IndexRange and confirm the base operation worksRead the node with no IndexRange. If that fails too, the problem is not the range - look at access level, node id or type. If it succeeds, you now have the actual value shape to build the range against.
  2. Read ValueRank and ArrayDimensions on the nodeValueRank tells you how many dimensions the range must contain. ArrayDimensions gives the declared size of each, though a value of 0 in ArrayDimensions means the dimension length is not fixed and you must use the length of the value you just read.
  3. Rebuild the range in canonical formZero-based, inclusive, colon separated, comma between dimensions, no whitespace. A single index is written as the bare number, for example 3, not 3:3, although both are usually accepted. For a 10-element array the last four elements are 6:9.
  4. Check the direction of your operationIf the range parses on Read but fails on Write, the server does not support partial writes on that node. Read the array, modify the elements locally, and write the whole array back in one operation.
  5. Capture the request on the wire if the syntax still looks rightWireshark decodes the OPC UA IndexRange as a plain string in the ReadValueId. Confirm that what left the client is what you think you set, since some client configuration layers escape or reformat the string.

Where it shows up, by tool and stack

Tool / stackWhat to do there
UaExpertThe Data Access View lets you append an IndexRange when adding a node, and the Attributes pane shows ValueRank and ArrayDimensions so you can size the range correctly before you type it.
asyncua (Python)The range travels as a plain string on the ReadValueId. asyncua does not validate it client-side, so a typo travels to the server unchanged and comes back as this code.
node-opcuaNumericRange accepts a string or a numeric pair. Constructing it from a JavaScript array with one-based indexes is a common source of off-by-one ranges that the server then rejects.
UA-.NETStandard (C#)ReadValueId.IndexRange and WriteValue.IndexRange are strings. Leave them null rather than empty when you want the whole value; some servers treat an empty string as a malformed range.
OPC PublisherIndexRange can be set per published node in the configuration file. A range that does not match the tag shape shows up as a per-item failure at monitored item creation rather than at publish time, so check the startup log.
Beckhoff TwinCATArray tags exposed from structured text keep their PLC bounds in the declaration, but OPC UA IndexRange is always zero-based regardless of whether the PLC array was declared starting at 1. This mapping catches out people who read the PLC declaration and use it directly.

What it looks like in the log

Read ns=4;s=Buffer with IndexRange 1-10 returned BadIndexRangeInvalid
ServiceFault: BadIndexRangeInvalid - index range has 2 dimensions, value has 1
CreateMonitoredItems item 7 failed: BadIndexRangeInvalid

Confirm the fix

Read the same node twice, once with the corrected IndexRange and once without, and confirm the ranged result is the expected slice of the full array with the expected length.

Stop it happening again

Store IndexRange alongside the node in configuration and validate it against ValueRank and ArrayDimensions at connect time, before creating monitored items. Fail loudly at startup rather than discovering a bad range at runtime.

Stuck on more than one of these? The troubleshooting clinic works through broken configurations end to end, on camera.

Troubleshooting clinic →

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.

Free download
OPC UA Status Code Diagnostic Tree
A 15-page diagnostic reference grouping every normative status code by what actually went wrong: with the first action for each, and the four questions that resolve most faults before you read a single code.
Get the free diagnostic tree →
Free, no course, no login