PC/SC Error Codes (SCARD_E_*): Common Developer Errors

What does a PC/SC error code such as 0x8010000C mean? It is the return value of a Windows smart card function (winscard.dll) and it names a problem in the PC/SC layer: the service, the reader, the connection or the card's presence. 0x8010000C is SCARD_E_NO_SMARTCARD: the program tried to connect but no card was on the reader. Every PC/SC code starts with 0x8010; SCARD_E_ codes are errors, SCARD_W_ codes are warnings about the card (removed, reset, not responding) and SCARD_F_ codes are internal failures. Some programs print the same value as a negative number, such as -2146435060.

This page is BSD Infotech's reference for these codes. It lists every code with its hex value, explains the 15 errors developers meet most with ACS readers (cause, the call that returns it, what to do), shows which call returns which code, covers the plain Windows codes such as 1, 6, 31 and 0x6F7, and the pcsc-lite differences on Linux and macOS. It ends with a C# helper that turns any code into its name. Status words such as 63 00 or 6A 82 are a different layer, covered in APDU status words. BSD Infotech is an independent ACS supplier and integrator, not the manufacturer.

Three different kinds of "error code" turn up when software talks to an ACS reader, and each one points to a different place. Decide which one you have before you look anything up. The layers themselves are explained in PC/SC architecture.

What you haveLooks likeWhere it comes fromWhere to look
PC/SC return code0x8010000B, -2146435061, SCARD_E_SHARING_VIOLATIONThe Windows Smart Card service or pcsc-lite: the call itself failed, so no command reached the cardThis page
Plain Windows (Win32) code1, 6, 31, 0x6F7, 0x109Windows or the driver, passed back through the same smart card callWin32 codes below
APDU status word90 00, 63 00, 6A 82 at the end of the replyThe card, or the reader for an ACS pseudo-APDU. The call succeeded (return code 0) and this is the answerStatus words; the model SDK pages

The order matters: check the return code first. Only when it is SCARD_S_SUCCESS (0) does the reply buffer hold a status word worth reading. The C# tutorial handles both in that order.

The same code can reach your log in several forms. All of these are SCARD_E_NO_READERS_AVAILABLE:

  • 0x8010002E: the form Microsoft and pcsc-lite use.
  • -2146435026: the same 32 bits read as a signed LONG, which is what the functions return. C#, Java and many log files print it this way.
  • 2148532270: read as unsigned. Microsoft's reference pages show this form next to the hex value.

Why every code starts with 0x8010. The values follow Microsoft's HRESULT layout: the top bit marks a failure and the next field is the facility, the part of Windows the error came from. Microsoft's error reference lists facility 16 (0x10), FACILITY_SCARD, for the smart card subsystem. So 0x8010xxxx means "failure, from smart card", and the last four digits pick the error. The SCARD_W_ warnings are still failures by this rule (top bit set) and must be handled as errors.

Win32 codes are different. Microsoft's Smart Card Return Values page notes that some values may be the same as existing Windows return values for a similar condition, and points to the System Error Codes list for codes it does not show. In practice a smart card call can return a small plain number such as 1 (ERROR_INVALID_FUNCTION), 6 (ERROR_INVALID_HANDLE), 31 (ERROR_GEN_FAILURE) or 0x6F7 (1783, RPC_X_BAD_STUB_DATA). These come straight from Windows or the driver and are not in the 0x8010 range. Microsoft documents one of them for a smart card function directly: ERROR_BROKEN_PIPE (0x109) from SCardEstablishContext in a remote session without smart card redirection.

0x8007xxxx is a wrapped Win32 code. Some libraries and COM-based tools convert a Win32 code to an HRESULT with Microsoft's HRESULT_FROM_WIN32, which keeps the low 16 bits and adds facility 7 (FACILITY_WIN32). 6 then appears as 0x80070006. Take the last four digits and look them up as a Win32 code. The C# helper does this for you.

Grouped by what went wrong. The value in brackets is the signed decimal form. Each row has its own link anchor (for example #no-smartcard), so support notes and other pages can point straight to it. Causes marked for ACS readers come from BSD's guides and ACS's documentation; they have not yet been reproduced on each reader by BSD.

The service or your context is gone

CodeUsually returned byLikely cause with ACS readersWhat to do
SCARD_E_NO_SERVICE
0x8010001D (-2146435043)
SCardEstablishContext; any later call if the service is goneThe Smart Card service (SCardSvr) is not running. On Windows it normally starts when a reader is plugged in, so the usual reasons are: no ACS reader connected, the service set to Disabled, or an ACR1552U switched to keyboard-only mode, which Windows does not see as a smart card reader at all.Plug the reader in, then check the service (Check 1). Set a disabled service back to Manual (service settings). For the ACR1552U, switch it back to PC/SC mode.
SCARD_E_SERVICE_STOPPED
0x8010001E (-2146435042)
Any call on a context made earlier, often a waiting SCardGetStatusChangeThe service stopped or restarted while your program held a context: the last reader was unplugged, a driver was updated, or someone restarted the service. A long-running reader watcher meets this sooner or later.Treat the context as dead: release it, establish a new one and list the readers again. The reader watcher shows the pattern.
SCARD_E_INVALID_HANDLE
0x80100003 (-2146435069)
Any call that takes a context or card handleNot a reader fault. Your code used a handle after SCardReleaseContext or SCardDisconnect, after a service restart, from the wrong context, or stored it in a 32-bit int in a 64-bit process.Keep handles in IntPtr/nint, release each one once, and rebuild the context on this code. See 64-bit notes and the error groups.

The reader is missing or has a different name

CodeUsually returned byLikely cause with ACS readersWhat to do
SCARD_E_NO_READERS_AVAILABLE
0x8010002E (-2146435026)
SCardListReaders (Microsoft documents it there as "group contains no readers")The service runs but no PC/SC reader is registered: reader unplugged, driver problem, ACR1552U in keyboard-only mode, or a Remote Desktop session without smart card redirection.In code, treat it as "no reader yet", not as a crash: show a message and wait for a reader (watching for readers). For users: list the readers and check Remote Desktop.
SCARD_E_UNKNOWN_READER
0x80100009 (-2146435063)
SCardConnect, SCardGetStatusChangeThe reader name your code passes does not exactly match a current reader. Typical with ACS readers: a hard-coded name, the number at the end of the name changing when a second reader is connected, or the SAM entry name used instead of the PICC entry.Never hard-code the full name. Take it from a fresh SCardListReaders and match on a part such as ACR1252 plus PICC. See matching ACS reader names.

The card is missing, moved or not answering

CodeUsually returned byLikely cause with ACS readersWhat to do
SCARD_E_NO_SMARTCARD
0x8010000C (-2146435060)
SCardConnect (shared or exclusive), SCardReconnectNo card on the reader at the moment of connecting. With ACS readers also: the SAM entry selected instead of the contactless (PICC) entry, a card type the reader cannot read (for example a 125 kHz badge), or a connect attempt made a moment before the reader has seen the card.Wait for SCARD_STATE_PRESENT with SCardGetStatusChange before connecting. To talk to the reader with no card (escape commands), connect with SCARD_SHARE_DIRECT instead.
SCARD_W_REMOVED_CARD
0x80100069 (-2146434967)
SCardTransmit, SCardStatus, SCardBeginTransactionThe card left the field or slot during the exchange. On contactless readers this is a short tap, a card held at the edge of the field or lifted before a multi-command read or write finished.Dispose the connection, ask the user to hold the card flat and still, and wait for the next card. Do not retry in a tight loop. After an interrupted write, read the data back before trusting it.
SCARD_W_UNRESPONSIVE_CARD
0x80100066 (-2146434970)
SCardConnect, SCardReconnectThe card did not answer the reset. On the ACR39U: card inserted the wrong way or not fully, dirty contacts or a damaged card. On contactless readers: a card the reader cannot activate, or one at the edge of the field. The reader state often shows MUTE at the same time.Try a known good card of a supported type. Insert contact cards chip first and face up. Check the state and ATR with the status check or ACS QuickView.
SCARD_W_RESET_CARD
0x80100068 (-2146434968)
SCardTransmit, SCardStatus, SCardBeginTransaction, SCardEndTransactionAnother program or thread reset the card while you were connected in shared mode, for example a test tool that disconnected with SCARD_RESET_CARD. Microsoft documents it for SCardBeginTransaction (Windows 8 and later) and says that after it, SCardEndTransaction has released the transaction.Call SCardReconnect to acknowledge the reset, then start again from the beginning: a reset clears the card's state, so select the application or authenticate again. Avoid running two card programs at once.
SCARD_E_PROTO_MISMATCH
0x8010000F (-2146435057)
SCardConnect, SCardReconnect; on pcsc-lite also SCardTransmitYou asked for a protocol the card is not using: only T=0 for a T=1 card, or the reverse. Microsoft also notes that SCardReconnect must include the current protocol.Request SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1 and use the protocol SCardConnect returns in every SCardTransmit header.
SCARD_E_TIMEOUT
0x8010000A (-2146435062)
SCardGetStatusChangeNot a fault: the time-out you passed ran out and no reader changed state. SCARD_E_CANCELLED (0x80100002) is its partner: your own code ended the wait with SCardCancel.Loop and wait again, or stop cleanly. See threads and cancellation.

Another program has the card, or a transaction went wrong

CodeUsually returned byLikely cause with ACS readersWhat to do
SCARD_E_SHARING_VIOLATION
0x8010000B (-2146435061)
SCardConnect, SCardReconnect, SCardBeginTransactionAnother program holds the card or reader: ACS QuickView, the Script Tool, a BSD utility, the ACS Reader Monitor Program, a browser bridge, or a second copy of your own program. Also when you ask for exclusive access while others are connected, or when a program has the reader in direct mode, which on Windows reserves the reader.Close the other program (find it), connect in shared mode, and release connections promptly. See share modes.
SCARD_E_NOT_TRANSACTED
0x80100016 (-2146435050)
Windows: SCardEndTransaction. pcsc-lite: also SCardTransmit and SCardControlOn Windows, the program ended a transaction that does not exist: SCardEndTransaction without a successful SCardBeginTransaction, called twice, or after a reset had already released it. On Linux and macOS (pcsc-lite) the same value means the exchange itself failed, often because the card left the field.Pair each successful begin with exactly one end (try/finally). On pcsc-lite, handle it like a lost card: reconnect and retry the whole operation.

Fix the code or the driver

CodeUsually returned byLikely cause with ACS readersWhat to do
SCARD_E_INSUFFICIENT_BUFFER
0x80100008 (-2146435064)
SCardListReaders, SCardStatus, SCardGetAttrib, SCardTransmit, SCardControlThe buffer you passed is smaller than the answer: a fixed-size reader list when several ACS readers (each with a PICC and SAM entry) are connected, or a receive buffer too small for the reply.Ask for the size first (pass a null buffer), as the status check does. For short APDUs, a 258-byte receive buffer covers 256 data bytes plus SW1 SW2.
ERROR_INVALID_FUNCTION
0x00000001 (1)
SCardControl with an ACS escape commandThe escape command did not reach the reader's escape interface. Microsoft documents that its built-in CCID class driver accepts escape requests only after the EscapeCommandEnable registry value is set; it does not name the error code returned otherwise, and developers commonly report this one ("Incorrect function"). Other causes: the raw number 3500 passed instead of SCARD_CTL_CODE(3500), or an ACR122U command sent with no card on the reader.Install the ACS PC/SC driver for the model (built-in vs ACS driver), use control code 0x3136B0, connect in direct mode to the PICC entry. See the firmware check troubleshooting.

Turning these groups into program logic (retry, wait, rebuild the context, tell the user) is shown in the C# error handling groups. Many other codes from the full table appear on ACS readers too, such as SCARD_E_READER_UNAVAILABLE (reader unplugged or reset while in use), SCARD_W_UNPOWERED_CARD, SCARD_E_COMM_DATA_LOST and SCARD_F_COMM_ERROR (connection with the card or reader broke: replug the reader, try another USB port, hold the card still); the status check page gives a practical reading for each.

Knowing the call narrows the cause quickly. Microsoft's reference lists specific codes for only a few functions and refers to the general list for the rest, so this table combines those notes, the per-function lists in the pcsc-lite API documentation and BSD's own guides. It shows the codes you are most likely to see, not every possible one. Any call can also return SCARD_E_NO_SERVICE, SCARD_E_SERVICE_STOPPED or SCARD_E_INVALID_HANDLE once the context is gone.

CallCodes you will typically seeWhat the call does
SCardEstablishContextNO_SERVICE, ERROR_BROKEN_PIPE (0x109, documented by Microsoft)Connects your program to the Smart Card service
SCardListReadersNO_READERS_AVAILABLE and READER_UNAVAILABLE (both documented by Microsoft), INSUFFICIENT_BUFFERLists reader names
SCardGetStatusChangeTIMEOUT, CANCELLED, UNKNOWN_READER, READER_UNAVAILABLE, SERVICE_STOPPEDWaits for a card or reader change
SCardConnectNO_SMARTCARD, SHARING_VIOLATION, UNKNOWN_READER, W_UNRESPONSIVE_CARD, W_UNPOWERED_CARD, PROTO_MISMATCH, READER_UNAVAILABLEOpens a connection to the card (or the reader, in direct mode)
SCardReconnectPROTO_MISMATCH, NO_SMARTCARD, W_REMOVED_CARD, SHARING_VIOLATIONRe-opens a connection, for example after a reset
SCardBeginTransaction / SCardEndTransactionW_RESET_CARD (documented by Microsoft for both), NOT_TRANSACTED, SHARING_VIOLATION, READER_UNAVAILABLEHolds the card for a sequence of commands
SCardTransmitW_REMOVED_CARD, W_RESET_CARD, INSUFFICIENT_BUFFER, COMM_DATA_LOST; on pcsc-lite also NOT_TRANSACTED and PROTO_MISMATCH; 0x6F7 (see Win32 codes)Sends an APDU to the card; the status word comes back in the reply
SCardControlERROR_INVALID_FUNCTION (1), ERROR_GEN_FAILURE (31), INSUFFICIENT_BUFFER; on pcsc-lite SCARD_E_UNSUPPORTED_FEATURE and NOT_TRANSACTEDSends an escape command to the reader (Transmit vs Control)
SCardStatusW_REMOVED_CARD, W_RESET_CARD, INSUFFICIENT_BUFFERReads the state, protocol and ATR of a connected card

The ACS PC/SC Learning Tool runs these calls one at a time and shows each return code, which is a quick way to see at which step a reader or card fails before you debug your own code.

These are not in Microsoft's smart card list, so a lookup table of SCARD_* names will not find them. Their names and meanings come from Microsoft's System Error Codes. Which call returns them, and why, is not documented by Microsoft for the smart card functions: the "usual situation" column is what developers commonly report, and BSD has not yet reproduced these on its readers.

ValueName and Microsoft meaningUsual situationWhat to check
1 (0x1)ERROR_INVALID_FUNCTION: incorrect functionSCardControl with an escape command the driver does not pass onSee the escape command row: ACS driver, control code, direct mode, PICC entry.
6 (0x6)ERROR_INVALID_HANDLE: the handle is invalidA context or card handle that is no longer valid, the Win32 counterpart of SCARD_E_INVALID_HANDLESame as SCARD_E_INVALID_HANDLE: handle lifetime and 64-bit handle types.
31 (0x1F)ERROR_GEN_FAILURE: a device attached to the system is not functioningSCardControl or SCardTransmit when the driver or reader rejects the request: a control code or escape command the reader does not support, or a reader that stopped respondingCheck the command against the reader's ACS manual (each model has its own escape commands), replug the reader, check Device Manager.
1783 (0x6F7)RPC_X_BAD_STUB_DATA: the stub received bad dataBuffer pointers and lengths that do not agree, for example a receive length larger than the buffer, a wrong SCARD_IO_REQUEST, or a P/Invoke declaration with the wrong typesCompare your declarations with a known good one, such as WinScard.cs; pass the real buffer length.
0x109 (265)ERROR_BROKEN_PIPE (in Microsoft's smart card list)SCardEstablishContext in a remote session whose system does not support smart card redirection (documented)Remote Desktop and smart cards.

All smart card return values in Microsoft's Smart Card Return Values list (defined in Scarderr.h), in numeric order. The meaning column is BSD's short summary of Microsoft's description. The last column compares the pcsc-lite 2.4.1 error code list. Linked names have a detailed entry above. Most codes in the 0x80100020 to 0x80100034 and 0x8010006A to 0x80100072 ranges belong to smart card file, PIN and certificate functions (for example Windows sign-in cards) and you will rarely see them from plain PC/SC code with MIFARE, NTAG or DESFire cards.

NameHex / signed decimalMeaning (Microsoft, summarised)pcsc-lite
SCARD_S_SUCCESS0x00000000
0
Success: no error.Same
SCARD_F_INTERNAL_ERROR0x80100001
-2146435071
An internal consistency check failed.Same
SCARD_E_CANCELLED0x80100002
-2146435070
The action was cancelled by an SCardCancel call.Same
SCARD_E_INVALID_HANDLE0x80100003
-2146435069
The handle passed in is not valid.Same
SCARD_E_INVALID_PARAMETER0x80100004
-2146435068
One or more parameters could not be interpreted.Same
SCARD_E_INVALID_TARGET0x80100005
-2146435067
Registry start-up information is missing or not valid.Same
SCARD_E_NO_MEMORY0x80100006
-2146435066
Not enough memory to complete the command.Same
SCARD_F_WAITED_TOO_LONG0x80100007
-2146435065
An internal consistency timer expired.Same
SCARD_E_INSUFFICIENT_BUFFER0x80100008
-2146435064
The buffer for the returned data is too small.Same
SCARD_E_UNKNOWN_READER0x80100009
-2146435063
The reader name is not recognised.Same
SCARD_E_TIMEOUT0x8010000A
-2146435062
The time-out you set has expired.Same
SCARD_E_SHARING_VIOLATION0x8010000B
-2146435061
The card cannot be used because of other connections to it.Same
SCARD_E_NO_SMARTCARD0x8010000C
-2146435060
The call needs a card, but there is none in the reader.Same
SCARD_E_UNKNOWN_CARD0x8010000D
-2146435059
The smart card name is not recognised.Same
SCARD_E_CANT_DISPOSE0x8010000E
-2146435058
The card could not be disposed of in the way requested.Same
SCARD_E_PROTO_MISMATCH0x8010000F
-2146435057
The requested protocols do not match the protocol in use with the card.Also documented by pcsc-lite for SCardTransmit when the connect protocol differs from the one requested.
SCARD_E_NOT_READY0x80100010
-2146435056
The reader or card is not ready for commands.Same
SCARD_E_INVALID_VALUE0x80100011
-2146435055
One or more parameter values could not be interpreted.Same
SCARD_E_SYSTEM_CANCELLED0x80100012
-2146435054
The system cancelled the action, for example to log off or shut down.Same
SCARD_F_COMM_ERROR0x80100013
-2146435053
An internal communications error was detected.Same
SCARD_F_UNKNOWN_ERROR0x80100014
-2146435052
An internal error with an unknown source was detected.Same
SCARD_E_INVALID_ATR0x80100015
-2146435051
An ATR read from the registry is not a valid ATR.Same
SCARD_E_NOT_TRANSACTED0x80100016
-2146435050
An attempt was made to end a transaction that does not exist.Different use: pcsc-lite also returns it from SCardTransmit and SCardControl when the exchange with the card or reader failed.
SCARD_E_READER_UNAVAILABLE0x80100017
-2146435049
The reader is not available for use at the moment.Same
SCARD_P_SHUTDOWN0x80100018
-2146435048
The operation was stopped so that the server application could exit.Same
SCARD_E_PCI_TOO_SMALL0x80100019
-2146435047
The PCI receive buffer is too small.Same
SCARD_E_READER_UNSUPPORTED0x8010001A
-2146435046
The reader driver does not meet the minimum requirements.Same
SCARD_E_DUPLICATE_READER0x8010001B
-2146435045
The reader driver did not give a unique reader name.Same
SCARD_E_CARD_UNSUPPORTED0x8010001C
-2146435044
The card does not meet the minimum requirements.Same
SCARD_E_NO_SERVICE0x8010001D
-2146435043
The smart card resource manager is not running.Same
SCARD_E_SERVICE_STOPPED0x8010001E
-2146435042
The smart card resource manager has shut down.Same
SCARD_E_UNEXPECTED0x8010001F
-2146435041
An unexpected card error occurred.pcsc-lite gives SCARD_E_UNSUPPORTED_FEATURE this same value.
SCARD_E_ICC_INSTALLATION0x80100020
-2146435040
No primary provider was found for the card.Same
SCARD_E_ICC_CREATEORDER0x80100021
-2146435039
The requested order of object creation is not supported.Same
SCARD_E_UNSUPPORTED_FEATURE0x80100022
-2146435038
The card does not support the requested feature.Not defined in pcsc-lite: there it is 0x8010001F.
SCARD_E_DIR_NOT_FOUND0x80100023
-2146435037
The directory does not exist on the card.Same
SCARD_E_FILE_NOT_FOUND0x80100024
-2146435036
The file does not exist on the card.Same
SCARD_E_NO_DIR0x80100025
-2146435035
The path is not a directory on the card.Same
SCARD_E_NO_FILE0x80100026
-2146435034
The path is not a file on the card.Same
SCARD_E_NO_ACCESS0x80100027
-2146435033
Access to the file is denied.Same
SCARD_E_WRITE_TOO_MANY0x80100028
-2146435032
More data was written than the target object can hold.Same
SCARD_E_BAD_SEEK0x80100029
-2146435031
Setting the card file pointer failed.Same
SCARD_E_INVALID_CHV0x8010002A
-2146435030
The PIN supplied is incorrect.Same
SCARD_E_UNKNOWN_RES_MNG0x8010002B
-2146435029
An unrecognised error code was returned.pcsc-lite name: SCARD_E_UNKNOWN_RES_MSG.
SCARD_E_NO_SUCH_CERTIFICATE0x8010002C
-2146435028
The requested certificate does not exist.Same
SCARD_E_CERTIFICATE_UNAVAILABLE0x8010002D
-2146435027
The requested certificate could not be obtained.Same
SCARD_E_NO_READERS_AVAILABLE0x8010002E
-2146435026
No smart card reader is available.Same
SCARD_E_COMM_DATA_LOST0x8010002F
-2146435025
A communications error with the card was detected.Same
SCARD_E_NO_KEY_CONTAINER0x80100030
-2146435024
The requested key container does not exist on the card.Same
SCARD_E_SERVER_TOO_BUSY0x80100031
-2146435023
The resource manager is too busy to complete the operation.Same
SCARD_E_PIN_CACHE_EXPIRED0x80100032
-2146435022
The card PIN cache has expired (not on Windows Server 2008, Vista or older).Not defined in pcsc-lite.
SCARD_E_NO_PIN_CACHE0x80100033
-2146435021
The card PIN cannot be cached (not on Windows Server 2008, Vista or older).Not defined in pcsc-lite.
SCARD_E_READ_ONLY_CARD0x80100034
-2146435020
The card is read-only and cannot be written (not on Windows Server 2008, Vista or older).Not defined in pcsc-lite.
SCARD_W_UNSUPPORTED_CARD0x80100065
-2146434971
The reader cannot talk to the card because of ATR configuration conflicts.Same
SCARD_W_UNRESPONSIVE_CARD0x80100066
-2146434970
The card does not respond to a reset.Same
SCARD_W_UNPOWERED_CARD0x80100067
-2146434969
Power was removed from the card, so communication cannot continue.Same
SCARD_W_RESET_CARD0x80100068
-2146434968
The card was reset.Same
SCARD_W_REMOVED_CARD0x80100069
-2146434967
The card was removed, so communication cannot continue.Same
SCARD_W_SECURITY_VIOLATION0x8010006A
-2146434966
Access was denied because of a security violation.Same
SCARD_W_WRONG_CHV0x8010006B
-2146434965
The wrong PIN was presented.Same
SCARD_W_CHV_BLOCKED0x8010006C
-2146434964
The maximum number of PIN attempts has been reached.Same
SCARD_W_EOF0x8010006D
-2146434963
The end of the card file was reached.Same
SCARD_W_CANCELLED_BY_USER0x8010006E
-2146434962
The user cancelled the action.Same
SCARD_W_CARD_NOT_AUTHENTICATED0x8010006F
-2146434961
No PIN was presented to the card.Same
SCARD_W_CACHE_ITEM_NOT_FOUND0x80100070
-2146434960
The requested item is not in the cache.Not defined in pcsc-lite.
SCARD_W_CACHE_ITEM_STALE0x80100071
-2146434959
The cache item was too old and has been deleted.Not defined in pcsc-lite.
SCARD_W_CACHE_ITEM_TOO_BIG0x80100072
-2146434958
The new cache item is larger than the cache allows per item.Not defined in pcsc-lite.

Not yet tested by BSD. BSD's test machines run Windows 10 and 11. This section compares the published pcsc-lite documentation with Microsoft's list; it makes no claim about a particular ACS reader on Linux or macOS.

pcsc-lite uses the same names and almost all the same values, so code and logs usually carry over. The differences that matter:

  • SCARD_E_UNSUPPORTED_FEATURE is 0x8010001F in pcsc-lite, the same value as SCARD_E_UNEXPECTED. Windows uses 0x80100022, which pcsc-lite does not define. A cross-platform name table needs both (the C# helper labels 0x8010001F with both names).
  • SCARD_E_NOT_TRANSACTED has a wider use in pcsc-lite: its API documentation lists it for SCardTransmit and SCardControl when the exchange was not successful. On Windows it means a transaction-pairing mistake. Treat it as a failed exchange on Linux and macOS.
  • 0x8010002B is named SCARD_E_UNKNOWN_RES_MSG in pcsc-lite and SCARD_E_UNKNOWN_RES_MNG by Microsoft.
  • Windows-only codes: the PIN cache and read-only card codes (0x80100032 to 0x80100034) and the cache warnings (0x80100070 to 0x80100072) are not in the pcsc-lite list. Plain Win32 codes such as 1, 6, 31 and 0x6F7 are a Windows matter too.
  • Error text: pcsc-lite provides pcsc_stringify_error(), which returns readable text for a code. Windows has no equivalent in winscard.dll, which is why Windows programs keep their own name table.

Other pcsc-lite differences (context scope, direct mode, control code numbers for escape commands) are on the PC/SC architecture page. For Java and Python, which run on both platforms, see ACS readers with Java and ACS readers with Python.

Language: C# 14 on .NET 10, Windows (P/Invoke to winscard.dll; no NuGet packages). Prerequisites: the .NET 10 SDK. Run dotnet new console, replace Program.cs with the code below, then dotnet run -- 0x8010000C -2146435060 1. Pass codes in any form (hex, negative or positive decimal); with no arguments it asks the Smart Card service once and names the result. It is a single file and does not need the WinScard.cs and Pcsc.cs files from the C# tutorial; if you use those, you can copy the PcscError class into your project in place of PcscErrors.Name. It never connects to a card and sends no commands.

Compiled by BSD; not yet tested on hardware. Built with dotnet build for net10.0 on 1 Dec 2026 (0 warnings, 0 errors) and run on a Windows 11 PC with no ACS reader attached: it named the test codes correctly and, without arguments, reported SCARD_S_SUCCESS for both calls (the PC has a built-in virtual smart card reader). It has not yet been run with an ACS reader.

// PC/SC return code names. C# 14, .NET 10, Windows. Compiled by BSD; not yet tested on hardware.
// Usage:  dotnet run -- 0x8010000C -2146435060 1 0x6F7
//         dotnet run            (no arguments: asks the Smart Card service once and names the result)
// Read-only: it never connects to a card and sends no commands.
using System.Globalization;
using System.Runtime.InteropServices;

if (args.Length == 0)
{
    // A live example: establish a context, ask for the reader list size, name whatever comes back.
    int rc = WinScard.SCardEstablishContext(0 /* SCARD_SCOPE_USER */, IntPtr.Zero, IntPtr.Zero, out IntPtr ctx);
    Console.WriteLine($"SCardEstablishContext: {PcscError.Describe(rc)}");
    if (rc != 0) return 1;
    try
    {
        uint chars = 0;
        rc = WinScard.SCardListReaders(ctx, null, null, ref chars);
        Console.WriteLine($"SCardListReaders:      {PcscError.Describe(rc)}");
    }
    finally { WinScard.SCardReleaseContext(ctx); }
    return 0;
}

foreach (string a in args)
{
    if (PcscError.TryParse(a, out int code)) Console.WriteLine($"{a,-14} {PcscError.Describe(code)}");
    else Console.WriteLine($"{a,-14} not a number (use 0x8010000C, -2146435060 or 1)");
}
return 0;

static class PcscError
{
    // Values from Microsoft's "Smart Card Return Values" (Scarderr.h) and, for the plain
    // Win32 codes, Microsoft's "System Error Codes". Same values in pcsc-lite except where noted.
    static readonly Dictionary<int, string> Names = new()
    {
        [0x00000000] = "SCARD_S_SUCCESS",
        [unchecked((int)0x80100001)] = "SCARD_F_INTERNAL_ERROR",
        [unchecked((int)0x80100002)] = "SCARD_E_CANCELLED",
        [unchecked((int)0x80100003)] = "SCARD_E_INVALID_HANDLE",
        [unchecked((int)0x80100004)] = "SCARD_E_INVALID_PARAMETER",
        [unchecked((int)0x80100005)] = "SCARD_E_INVALID_TARGET",
        [unchecked((int)0x80100006)] = "SCARD_E_NO_MEMORY",
        [unchecked((int)0x80100007)] = "SCARD_F_WAITED_TOO_LONG",
        [unchecked((int)0x80100008)] = "SCARD_E_INSUFFICIENT_BUFFER",
        [unchecked((int)0x80100009)] = "SCARD_E_UNKNOWN_READER",
        [unchecked((int)0x8010000A)] = "SCARD_E_TIMEOUT",
        [unchecked((int)0x8010000B)] = "SCARD_E_SHARING_VIOLATION",
        [unchecked((int)0x8010000C)] = "SCARD_E_NO_SMARTCARD",
        [unchecked((int)0x8010000D)] = "SCARD_E_UNKNOWN_CARD",
        [unchecked((int)0x8010000E)] = "SCARD_E_CANT_DISPOSE",
        [unchecked((int)0x8010000F)] = "SCARD_E_PROTO_MISMATCH",
        [unchecked((int)0x80100010)] = "SCARD_E_NOT_READY",
        [unchecked((int)0x80100011)] = "SCARD_E_INVALID_VALUE",
        [unchecked((int)0x80100012)] = "SCARD_E_SYSTEM_CANCELLED",
        [unchecked((int)0x80100013)] = "SCARD_F_COMM_ERROR",
        [unchecked((int)0x80100014)] = "SCARD_F_UNKNOWN_ERROR",
        [unchecked((int)0x80100015)] = "SCARD_E_INVALID_ATR",
        [unchecked((int)0x80100016)] = "SCARD_E_NOT_TRANSACTED",
        [unchecked((int)0x80100017)] = "SCARD_E_READER_UNAVAILABLE",
        [unchecked((int)0x80100018)] = "SCARD_P_SHUTDOWN",
        [unchecked((int)0x80100019)] = "SCARD_E_PCI_TOO_SMALL",
        [unchecked((int)0x8010001A)] = "SCARD_E_READER_UNSUPPORTED",
        [unchecked((int)0x8010001B)] = "SCARD_E_DUPLICATE_READER",
        [unchecked((int)0x8010001C)] = "SCARD_E_CARD_UNSUPPORTED",
        [unchecked((int)0x8010001D)] = "SCARD_E_NO_SERVICE",
        [unchecked((int)0x8010001E)] = "SCARD_E_SERVICE_STOPPED",
        [unchecked((int)0x8010001F)] = "SCARD_E_UNEXPECTED (pcsc-lite: also SCARD_E_UNSUPPORTED_FEATURE)",
        [unchecked((int)0x80100020)] = "SCARD_E_ICC_INSTALLATION",
        [unchecked((int)0x80100021)] = "SCARD_E_ICC_CREATEORDER",
        [unchecked((int)0x80100022)] = "SCARD_E_UNSUPPORTED_FEATURE (Windows)",
        [unchecked((int)0x80100023)] = "SCARD_E_DIR_NOT_FOUND",
        [unchecked((int)0x80100024)] = "SCARD_E_FILE_NOT_FOUND",
        [unchecked((int)0x80100025)] = "SCARD_E_NO_DIR",
        [unchecked((int)0x80100026)] = "SCARD_E_NO_FILE",
        [unchecked((int)0x80100027)] = "SCARD_E_NO_ACCESS",
        [unchecked((int)0x80100028)] = "SCARD_E_WRITE_TOO_MANY",
        [unchecked((int)0x80100029)] = "SCARD_E_BAD_SEEK",
        [unchecked((int)0x8010002A)] = "SCARD_E_INVALID_CHV",
        [unchecked((int)0x8010002B)] = "SCARD_E_UNKNOWN_RES_MNG (pcsc-lite: SCARD_E_UNKNOWN_RES_MSG)",
        [unchecked((int)0x8010002C)] = "SCARD_E_NO_SUCH_CERTIFICATE",
        [unchecked((int)0x8010002D)] = "SCARD_E_CERTIFICATE_UNAVAILABLE",
        [unchecked((int)0x8010002E)] = "SCARD_E_NO_READERS_AVAILABLE",
        [unchecked((int)0x8010002F)] = "SCARD_E_COMM_DATA_LOST",
        [unchecked((int)0x80100030)] = "SCARD_E_NO_KEY_CONTAINER",
        [unchecked((int)0x80100031)] = "SCARD_E_SERVER_TOO_BUSY",
        [unchecked((int)0x80100032)] = "SCARD_E_PIN_CACHE_EXPIRED",
        [unchecked((int)0x80100033)] = "SCARD_E_NO_PIN_CACHE",
        [unchecked((int)0x80100034)] = "SCARD_E_READ_ONLY_CARD",
        [unchecked((int)0x80100065)] = "SCARD_W_UNSUPPORTED_CARD",
        [unchecked((int)0x80100066)] = "SCARD_W_UNRESPONSIVE_CARD",
        [unchecked((int)0x80100067)] = "SCARD_W_UNPOWERED_CARD",
        [unchecked((int)0x80100068)] = "SCARD_W_RESET_CARD",
        [unchecked((int)0x80100069)] = "SCARD_W_REMOVED_CARD",
        [unchecked((int)0x8010006A)] = "SCARD_W_SECURITY_VIOLATION",
        [unchecked((int)0x8010006B)] = "SCARD_W_WRONG_CHV",
        [unchecked((int)0x8010006C)] = "SCARD_W_CHV_BLOCKED",
        [unchecked((int)0x8010006D)] = "SCARD_W_EOF",
        [unchecked((int)0x8010006E)] = "SCARD_W_CANCELLED_BY_USER",
        [unchecked((int)0x8010006F)] = "SCARD_W_CARD_NOT_AUTHENTICATED",
        [unchecked((int)0x80100070)] = "SCARD_W_CACHE_ITEM_NOT_FOUND",
        [unchecked((int)0x80100071)] = "SCARD_W_CACHE_ITEM_STALE",
        [unchecked((int)0x80100072)] = "SCARD_W_CACHE_ITEM_TOO_BIG",
        // Plain Win32 system error codes that smart card calls can also return.
        [1] = "ERROR_INVALID_FUNCTION (Win32: Incorrect function)",
        [6] = "ERROR_INVALID_HANDLE (Win32: The handle is invalid)",
        [31] = "ERROR_GEN_FAILURE (Win32: A device attached to the system is not functioning)",
        [50] = "ERROR_NOT_SUPPORTED (Win32: The request is not supported)",
        [122] = "ERROR_INSUFFICIENT_BUFFER (Win32: The data area passed to a system call is too small)",
        [0x109] = "ERROR_BROKEN_PIPE (no smart card redirection in this remote session)",
        [0x6F7] = "RPC_X_BAD_STUB_DATA (Win32: The stub received bad data)",
    };

    /// <summary>Name of a PC/SC or Win32 return code, or null if this table does not know it.</summary>
    public static string? Name(int code)
    {
        if (Names.TryGetValue(code, out var n)) return n;
        // HRESULT_FROM_WIN32 form (0x8007xxxx): unwrap and name the Win32 code inside.
        if (((uint)code & 0xFFFF0000) == 0x80070000 && Names.TryGetValue(code & 0xFFFF, out n))
            return $"HRESULT_FROM_WIN32({n})";
        return null;
    }

    /// <summary>Hex, signed decimal and name, e.g. "0x8010000C (-2146435060) SCARD_E_NO_SMARTCARD".</summary>
    public static string Describe(int code)
    {
        string name = Name(code) ?? (((uint)code >> 16) == 0x8010
            ? "unknown smart card code (facility 0x10, FACILITY_SCARD)"
            : "not in this table: look it up in Microsoft's System Error Codes");
        return $"0x{code:X8} ({code}) {name}";
    }

    /// <summary>Accepts 0x8010000C, -2146435060, 2148532236 or 1.</summary>
    public static bool TryParse(string s, out int code)
    {
        s = s.Trim();
        if (s.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
            return TryUInt(s.AsSpan(2), NumberStyles.HexNumber, out code);
        if (int.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out code)) return true;
        return TryUInt(s, NumberStyles.Integer, out code);
    }

    static bool TryUInt(ReadOnlySpan<char> s, NumberStyles style, out int code)
    {
        bool ok = uint.TryParse(s, style, CultureInfo.InvariantCulture, out uint u);
        code = unchecked((int)u);
        return ok;
    }
}

static class WinScard
{
    [DllImport("winscard.dll")]
    public static extern int SCardEstablishContext(uint scope, IntPtr reserved1, IntPtr reserved2, out IntPtr context);

    [DllImport("winscard.dll")]
    public static extern int SCardReleaseContext(IntPtr context);

    [DllImport("winscard.dll", EntryPoint = "SCardListReadersW", CharSet = CharSet.Unicode)]
    public static extern int SCardListReaders(IntPtr context, string? groups, char[]? readers, ref uint chars);
}

Expected result: for dotnet run -- 0x8010000C -2146435060 1 0x80070006, four lines: two naming SCARD_E_NO_SMARTCARD (the same code in two forms), one ERROR_INVALID_FUNCTION and one HRESULT_FROM_WIN32(ERROR_INVALID_HANDLE ...). An unlisted 0x8010xxxx value is reported as an unknown smart card code; anything else is sent to Microsoft's System Error Codes list.

In your own code: log the call name together with PcscError.Describe(rc), for example SCardConnect: 0x8010000B (-2146435061) SCARD_E_SHARING_VIOLATION. That one line answers the first two support questions: which call, and which code.

What you seeLikely causeWhat to do
A negative number such as -2146435060 in a logThe code printed as a signed 32-bit valueConvert to hex (Windows Calculator, Programmer mode, DWORD) or use the C# helper. It becomes 0x8010000C.
A code starting 0x8007A Win32 code wrapped as an HRESULT by a libraryLook up the last four hex digits as a Win32 code.
Return code 0, but the operation still failedThe call worked; the card or reader refused the commandRead the last two bytes of the reply: status words.
Your C# code says "unknown error" for a real codeA name table with only the common codes, or uint and int mixed in a comparisonUse the full table above; compare int with unchecked((int)0x8010000C).
The same program returns different codes on Windows and Linuxpcsc-lite values or meanings differ for a few codesSee pcsc-lite differences.
The code changes every time; the reader works in ACS QuickViewA lifecycle bug in your program (handles, threads, a second instance)Compare with the C# PC/SC tutorial and the read-only status check.
Errors only in a Remote Desktop sessionSmart card redirectionRemote Desktop: which readers a session sees.
Errors before your program even starts: reader missing, yellow mark in Device ManagerBelow PC/SC: USB, driver or reader modeStart at the troubleshooting centre.

Code names, values and meanings were checked in Microsoft's documentation and the pcsc-lite 2.4.1 documentation on 1 Dec 2026. Meanings are summarised in BSD's words. ACS-specific causes come from ACS's manuals and product pages as cited on the BSD guides linked above. The C# helper was written by BSD Infotech.

BSD Infotech is an independent ACS supplier and integrator, not the manufacturer. ACS, the ACS logo and ACS product names belong to Advanced Card Systems Ltd. Windows and .NET are trademarks of Microsoft Corporation. MIFARE, MIFARE DESFire and NTAG are trademarks of NXP B.V.

Stuck on a PC/SC error code?

Tell us the reader model, the call that fails and the code you see. We help developers connect ACS readers to their applications on Windows.