NFC Tag Write Errors: Read-Only vs Tag Lost, and What Each Means
A read-only error means the tag is locked for good. A tag lost error means the connection dropped, so retry. Here is how to tell which one you got.
A read-only error means the tag is locked and will not accept writes, so you need a different tag. A tag lost error means the connection dropped partway through, so you hold everything still and try again. They can look alike on screen. One is permanent, though, and the other is just a retry.
What a read-only error means
A locked tag cannot be written to. WakDev's troubleshooting guide puts the fix bluntly: confirm the lock by reading the tag, then use a different tag.
Locking is one-way, too. Android's Ndef reference says makeReadOnly() sets the capability container (CC) field to read-only and, where possible, permanently sets the lock bits. Its words: this is a one-way process and cannot be reverted. The call returns false when the tag can't be made read-only at all.
The chip itself works the same way. On NTAG213, an NXP community answer explains that lock bits are irreversible: a bit set to 1 can't be changed back to 0 over NFC. Locked pages can't be reprogrammed with any write command. Other chips can behave differently, so check the datasheet for yours.
If you aren't sure whether a tag is really locked, see how to check whether a tag is really locked. A locked tag is also not the same as a password-protected one; password protection and permanent locking work differently.
What a tag lost error means
A tag lost error means the tag left the phone's field while the write was running. On Android, writeNdefMessage throws TagLostException if the tag leaves the field. It throws FormatException if the message is malformed and IOException for other I/O failures.
The tag's lock state isn't the issue here. WakDev says movement during the operation can cause errors, and the fix is to hold the tag steady for the whole read or write, then retry. If it keeps happening, look at where the NFC antenna sits on your phone and whether your case gets in the way.
How to tell them apart
Use the pattern, not the wording of the message. A tag lost error is recoverable, while a lock is permanent, so it pays to work out which one you have before you retry ten times or throw a good tag away:
- Fails every time on that tag, even when you hold still: suspect a lock. Try a fresh tag of the same type. If the fresh one writes fine, the first tag is locked or otherwise unwritable.
- Fails sometimes, works when you hold still: that's a tag lost problem. Reposition and retry.
- Fails on every tag: the problem is likely your phone, case or setup, not the tags.
Apps can also check before writing. On iPhone, Core NFC has a read-only status that an app can test before it writes, so a locked tag shows up as locked instead of looking like a flaky write. To write tags yourself, get NFCore on the App Store or Google Play.
Other causes that look similar
WakDev lists a few more reasons a write fails:
- Not enough memory: confirm the tag's capacity before you write.
- Protected cards: access, credit and transport cards are protected against reading, writing and copying. Use a standard, unprotected tag.
- Incompatible tag technology: your device may not support the tag type.
- Interference or damage: phone cases, batteries, metal surfaces, and bent, cut or burned tags can block the signal.
What to do next
If it's tag lost, hold the phone and tag still, take off the case if needed, keep metal away, and try again. If it's read-only, the lock can't be undone on common tags, so use a new tag and think twice before locking the next one.
Frequently Asked Questions
Can I unlock a read-only NFC tag?
On common NTAG tags, lock bits set over NFC can't be cleared again, so plan to use a new tag. Some chips behave differently, so check the datasheet for your chip.
Is a tag lost error a sign the tag is broken?
Usually not. It means the connection dropped mid-operation, most often because the phone or tag moved. Hold both still and try again.
Why does the same write fail on one tag but work on another?
The failing tag may be locked, too small for the data, damaged or a protected card type. A working tag of the same type points at the first tag, not your phone.