Modbus Exception Codes 01/02/03/04 Explained (+ Fixes)

An exception response is actually good news: it proves your wiring, baud rate, slave ID, and CRC are all correct — the device heard you perfectly and is refusing on purpose. You can recognize one in the bus monitor: the response function code is the request code plus 0x80 (a request with FC 03 comes back as 0x83), followed by a single byte — the exception code.

CodeNameWhat it meansTypical causeFix
01Illegal FunctionThe slave doesn’t implement that function codeWriting with FC 16 to a read-only deviceUse only function codes listed in the device manual (QModMaster supports 01, 02, 03, 04, 05, 06, 15, 16)
02Illegal Data AddressThe register doesn’t exist at that addressEntering 40001 as the protocol address — the 0-based trapSubtract the base: 40001 → address 0 (see the addressing guide)
03Illegal Data ValueThe value or quantity is out of rangeWriting 70000 to a 16-bit register; requesting an illegal quantityCheck the register’s valid range and the device’s quantity limits
04Server Device FailureThe slave failed while executing the requestFaulted input channel, unconfigured module, transient device errorCheck device status indicators; retry; consult the manual
05AcknowledgeAccepted, still processingLong operations (calibration, EEPROM writes)Wait, then poll again
06Server Device BusyThe slave is busy right nowPolling too aggressivelyRetry with a delay; lengthen the scan interval
0BGateway Path UnavailableA gateway can’t reach the target slaveWrong slave ID behind the gateway; gateway misconfiguredCheck the gateway’s routing/forwarding table

Reading an exception in the bus monitor

Example: you send a read (FC 03) and the reply starts with 0x83 followed by 02 — that’s exception code 02, illegal data address. Match the code byte against the table above and you’ll usually have the fix in under a minute, instead of guessing at wiring that was never broken.

Frequently asked questions

I get exception 02 but the register definitely exists in the manual. Why?

Nine times out of ten it’s the 0-based vs 1-based trap: the manual prints register number 40001 while the protocol address on the wire is 0. Run through the addressing guide’s conversion before anything else.

Exception 04 — is my device broken?

Not necessarily. Code 04 means the device understood the request but failed while executing it — a faulted channel, an unconfigured module, or a transient internal error. Check the device’s status LEDs and diagnostics, then retry.

Why do I get exception 01 on a brand-new device?

The device simply doesn’t implement that function code. Check the manual’s Modbus map for its supported list — many simple sensors support reads (FC 01–04) but no writes at all.

What about exception codes on a Modbus TCP gateway?

Gateways add code 0B (gateway path unavailable) when they can’t reach the downstream serial slave. Verify the gateway’s serial settings and confirm the slave ID it forwards to actually exists on its RS485 side.

Related Guides

Similar Posts