Modbus Exception Codes Explained: What 0x01–0x0B Actually Mean

Every Modbus exception code, what triggers it, and the exact bytes you will see on the wire. A practical troubleshooting reference for 01, 02, 03, 04, 06, 0A and 0B.

When a Modbus slave cannot fulfil a request, it does not stay silent. It answers with an exception response: the original function code with the high bit set, followed by a single exception code byte.

That one byte is the fastest diagnostic signal in the protocol. Learn to read it and most field problems resolve in seconds.

How an exception response is built

Take a normal request for holding registers:

Request : 01 03 00 00 00 0A C5 CD
          ^^ ^^ ^^^^^ ^^^^^ ^^^^^
          ID FC  addr  qty   CRC

If the slave rejects it, the response is two bytes plus CRC:

Response: 01 83 02 C0 F1
          ^^ ^^^^^ ^^^^^
          ID  FC   code

The complete exception code table

CodeNameTypical real-world cause
01Illegal FunctionThe slave does not implement that function code at all. Often a device that only supports read functions receiving a write, or a gateway that does not pass 0x17 through.
02Illegal Data AddressThe requested address (or address + quantity) falls outside the slave's implemented range. This is the most common exception by far.
03Illegal Data ValueThe address was valid but the value was not — quantity 0, quantity above the device limit (often 125 registers / 2000 coils), or an out-of-range write value.
04Server Device FailureThe slave hit an internal fault while executing. Hardware problem, sensor fault, EEPROM write failure.
05AcknowledgeThe command was accepted but will take a long time. The master should poll later rather than retry immediately.
06Server Device BusyThe slave is processing a long command and cannot accept a new one. Back off and retry.
08Memory Parity ErrorThe slave detected a parity error in its own memory (extended file record access). Rare outside legacy devices.
0AGateway Path UnavailableThe gateway is configured correctly but has no route to the target device — usually a downstream RS-485 segment that is misconfigured or offline.
0BGateway Target Device Failed To RespondThe gateway tried the target device and got no reply at all — time-out on the downstream side. The device is unpowered, wrong slave ID, or wrong baud rate.

Distinguishing 0x02 from 0x0B

These two account for the majority of field calls, and they mean opposite things:

If you see 0x0B, stop checking your register map. Check the physical layer.

The single most common cause of 0x02: off-by-one addressing

Modbus protocol addresses are zero-based. Device documentation is almost always one-based. Holding register 40001 in a datasheet is PDU address 0.

If a device manual says "Holding Register 40011" and you send address 40011 (or even 11 when the block starts at 40001), you get 0x02. The correct PDU address is 10.

Rules that hold in practice:

Reading the exception in code

If you are using pymodbus, exceptions surface as typed errors rather than raw bytes:

from pymodbus.exceptions import ModbusIOException, ExceptionResponse
from pymodbus.pdu import ExceptionResponse as ExcResp

rr = client.read_holding_registers(address=0, count=10, slave=1)
if isinstance(rr, ExcResp):
    print(rr.exception_code)   # 2
elif rr.isError():
    print("transport error:", rr)

If you are parsing raw frames yourself, the check is one line:

if fc & 0x80:
    raise ModbusException(f"slave {unit} returned 0x{code:02X}")

Debugging order that actually saves time

  1. Confirm you get any reply at all. No reply is not an exception — it is a wiring, baud, parity, or slave-ID problem.
  2. Read the exception byte. 0x02 = address; 0x0B/0x0A = gateway path; 0x04/0x06 = device health.
  3. For 0x02, halve the problem. Request a single register at address 0. If that works but address 10 fails, your block offset is wrong. If address 0 fails too, the function code or the device's implemented range is wrong.
  4. For 0x03, check quantity limits. Many devices cap register reads well below the protocol maximum of 125.

You can reproduce all of this without hardware on the ModbusLab TCP slave, which accepts real Modbus TCP connections on port 502, or decode frames byte by byte in the message lab.