facturas SDK extends ArcaError and exposes a stable code string that you can match in your error-handling logic without parsing message text. The code never changes between patch releases, so you can safely store it in logs, route on it in monitoring rules, and use it in tests.
Error class hierarchy
All classes are importable from
facturas or from the dedicated facturas/errors subpath.
Predicate helpers
When you cannot useinstanceof — for example across module boundaries or in frameworks that re-wrap errors — use the exported predicate functions:
isArcaAuthenticationError as the only predicate helper. For all other error classes — ArcaConfigurationError, ArcaInputError, ArcaTransportError, ArcaSoapFaultError, ArcaServiceError — use instanceof directly.
Handling errors in practice
ArcaAuthenticationError fields
ArcaAuthenticationError exposes a narrow, safe set of diagnostic fields. Raw WSAA response bodies and credential values are never attached.
"invalid_token" | "unauthorized_computer" | "missing_relationship" | "authentication_rejected"
Stable typed reason for the authentication failure.
string
The ARCA service that rejected authentication (e.g.
"wsfe", "wsmtxca").string
The specific operation that triggered the error.
string | number | undefined
The provider-supplied error code, if available. Redacted to 512 characters maximum.
ArcaInputError codes
ArcaInputError carries one of these stable code values, along with optional field and expected properties pointing to the offending input:
Troubleshooting FAQ
coe.alreadyAuthenticated — WSAA rejects the login attempt
coe.alreadyAuthenticated — WSAA rejects the login attempt
ARCA’s WSAA rejects a login request when a valid ticket for the same certificate and service is already active. This happens when multiple workers or serverless invocations each attempt a cold-start token fetch simultaneously.Fix: configure a shared
wsaaSessionStore (or a unified store) so that workers reuse valid tickets instead of each fetching a new one. The in-memory cache cannot be shared across process boundaries. See Stores for adapter options and Configuration for the wsaaSessionStore interface.ARCA_INPUT_IDEMPOTENCY_MISMATCH — the idempotency key already exists with different input
ARCA_INPUT_IDEMPOTENCY_MISMATCH — the idempotency key already exists with different input
You submitted an idempotency key that is already recorded in the store, but the new input differs from the original — the operation, provider (
wsfe vs wsmtxca), explicit voucher number, or input payload changed.Fix: Either resubmit with the exact original input to retrieve the existing outcome, or generate a new idempotency key for the changed request. Idempotency reservation records are immutable and cannot be overwritten.ARCA_CONFIGURATION_ERROR on startup — missing environment variable
ARCA_CONFIGURATION_ERROR on startup — missing environment variable
createArcaClient() validates configuration immediately and throws if any required field is absent. The most common cause is a missing ARCA_ENVIRONMENT.Fix: Verify that all four required environment variables are set in your deployment environment:ARCA_TAX_ID— 11-digit CUITARCA_CERTIFICATE_PEM— PEM-encoded certificateARCA_PRIVATE_KEY_PEM— PEM-encoded private key matching the certificateARCA_ENVIRONMENT— exactlytestorproduction
npx facturas check to diagnose configuration problems from the command line. See CLI Commands for details.Network errors or timeouts — requests to ARCA are failing
Network errors or timeouts — requests to ARCA are failing
ArcaTransportError is thrown when the HTTP connection fails, times out, or returns a non-XML error response. ARCA’s services can occasionally be slow or unavailable, especially during peak hours.Fix: Increase the timeout option and configure retries with a retryDelay in your client:ArcaTransportError. SOAP faults and business rejections are not retried. Authorization calls (issue(), issueCreditNote()) always make exactly one CAE request per invocation regardless of the retries setting.Expired or mismatched certificate
Expired or mismatched certificate
If your certificate PEM is expired, ARCA will reject WSAA authentication. If the certificate and private key do not correspond to each other, the SDK will fail to sign the WSAA request.Fix: Replace the
ARCA_CERTIFICATE_PEM value with a renewed certificate that was generated from the same private key. Redeploy or restart the process so the new value is picked up. Confirm the certificate and key match before deploying by verifying that their public key fingerprints are identical.WSFE error 10015 — invalid DocTipo / DocNro combination
WSFE error 10015 — invalid DocTipo / DocNro combination
ARCA error
10015 indicates that the receiver document type and number combination is inconsistent for the selected voucher type and total. Factura B has specific rules about when a CUIT, DNI, or final-consumer identification is required based on the invoice total.Fix: Check the receiver’s condition, cuit, and the invoice total against ARCA’s rules for the voucher type. For amounts above the final-consumer threshold, a full CUIT is required.WSFE error 10016 — wrong voucher number
WSFE error 10016 — wrong voucher number
ARCA error
10016 means the number in CbteDesde is not the next valid number for that sales point and voucher type. This happens when another process has issued a voucher between your getNextVoucherNumber() call and your issue() call.Fix: Call getNextVoucherNumber() immediately before authorizing — not cached from an earlier call — to get the current next number. When using idempotencyKey, the SDK handles number assignment for you; only specify an explicit number when you have a strong reason to do so.Diagnostic checklist
When an error is unclear, work through these steps in order:- Confirm the certificate and private key correspond to each other (matching public key fingerprint).
- Confirm
ARCA_ENVIRONMENTis set to the correct value for your deployment. - Confirm the service authorisation is in place for that environment.
- Confirm the voucher type, document type, and amount combination is valid for the issuer and receiver conditions.
- Confirm your process is not reusing a stale assumption about the next voucher number.
npx facturas check. See CLI Commands for the full list of available checks.