NFC Agent

Errors

The error shape and every code the agent sends.

How the agent reports a refused request, and every code it sends.

Shape

A refused request on either endpoint is answered with type: "error":

{
  "id": "req_1",
  "type": "error",
  "success": false,
  "error": "data too large: 900 bytes exceeds tag NDEF capacity of 504 bytes",
  "payload": { "code": "CAPACITY_EXCEEDED", "retryable": false }
}
FieldDescription
idThe request's id, when it had one
errorA message for a person. Not stable; branch on code
payload.codeStable string, from the tables below
payload.retryableWhether sending the identical request again could succeed
payload.op, payload.tagUIDThe operation and tag concerned. Sent on some errors only, so do not rely on them

Treat a code you do not recognise as not retryable. A newer agent may send codes this page does not list.

Deciding what to do

retryablecodeMeaningDo
trueTAG_REMOVED, NO_CARDThe tag is not in the fieldAsk for the tag, then send the same request
trueanything elseTransient: an I/O fault, a busy reader, a timeoutRetry with backoff
falseRefused on its meritsShow it; retrying changes nothing

Codes

The request

CodeRetryableMeaning
PARSE_ERRORnoThe message was not valid JSON
INVALID_PAYLOADnoThe payload does not fit the message type. Device endpoint
INVALID_REQUESTnoA field is missing or invalid, or an irreversible NTAG 424 operation lacks confirm: true
INVALID_MESSAGE_TYPEnoThe message is not valid at this point, such as a device sending anything before hello
UNKNOWN_TYPEnoThe agent does not know this message type
INVALID_DEVICEnoA device message named a deviceID other than the connection's own
REGISTRATION_FAILEDnoThe device could not be registered
TAG_NOT_NAMEDnoThe request named no tag. See Naming the tag
TAG_MISMATCHnoA different tag is present from the one named. Read the tag again
NO_CARDyesNothing is holding the tag named
BUSYyesEarlier work has not finished: a reader completing an operation its caller gave up on, a raw session holding the reader, or more requests queued than the connection allows
TIMEOUTyesAn NTAG 424 operation on a phone would not finish in time. Nothing was written
INTERNAL_ERRORyesThe agent is stopping, or failed unexpectedly
TAG_SEND_FAILEDyesA device's scan could not be passed on. Device endpoint
READ_ERRORyesThe agent could not read from the device connection
UNKNOWN_ERRORnoUnclassified

The tag

CodeRetryableMeaning
NOT_SUPPORTEDnoThe tag, reader or device cannot do this
READ_ONLYnoThe tag is locked, or the agent is in read-only mode
CAPACITY_EXCEEDEDnoThe message is larger than the tag's usable NDEF capacity
NO_PAYLOADnoThe tag holds no NDEF message. See Identity-only scans
MULTIPLE_TAGSnoMore than one tag is in the field. Separate them
INVALID_DATAnoData was malformed
AUTH_FAILEDnoAuthentication failed or no key is held. The same key fails again
RAW_CHANNEL_DISABLEDnoThe raw APDU channel is closed. See Configuration
RAW_SESSION_EXPIREDnoThe raw session ended. Begin a new one
TAG_REMOVEDyesThe tag left the field during the operation
TAG_NOT_CONNECTEDyesThe device holding the tag disconnected during the operation
WRITE_FAILEDyesThe write failed, including a device that did not answer within 20 seconds
LOCK_FAILEDnoThe lock failed for a reason with no more specific code
TRANSCEIVE_FAILEDyesThe exchange failed, or the card answered an NTAG 424 operation with an unexpected status
CAPABILITIES_FAILEDnoThe capabilities could not be read for a reason with no more specific code
READ_FAILEDyesA device reported that reading failed