API reference

Error codes

Every error code, what it means, whether retrying helps — plus the codes that appear as warnings rather than errors.

Last updated

Every failure is a structured error: code (a stable machine code that does not change between versions), message (a technical description), retryable (whether retrying as-is is meaningful) and possibly details.

How to use them

  • Branch on code, never parse message — the text may change.
  • When retryable is true, retrying as-is usually succeeds (waiting for a user to confirm, a rate-limit window ending…). When false, change the parameters or the environment first.
  • A machine-readable catalogue is exported from @printlink/types: ERROR_CATALOG and errorCatalogEntry(code), always in step with this page.
import { PrintLinkClient, PrintLinkError, TransportError } from '@printlink/sdk';

try {
  await client.connect();
  await client.ensureAuthorized();
} catch (err) {
  if (err instanceof PrintLinkError) {
    switch (err.code) {
      case 'PAIRING_PENDING':   // normal: ask the user to accept, then retry
        break;
      case 'PAIRING_DENIED':    // the user refused: explain and offer to retry
        break;
      case 'PERMISSION_DENIED': // missing permission: send them to the console
        break;
      default:
        console.warn(err.code, err.message, 'retryable =', err.retryable);
    }
  } else if (err instanceof TransportError) {
    // Transport: not running / wrong port / refused — guide install or check the port
  } else {
    throw err;
  }
}

Authorisation and connection

CodeMeaningRetryable
PAIRING_REQUIREDPairing has not been completedNo
PAIRING_PENDINGPermission requested; waiting for the local user (not a failure)Yes
PAIRING_DENIEDThe pairing request was refusedNo
PERMISSION_DENIEDBeyond the granted permissionsNo
TOKEN_INVALIDThe token is invalid or was revokedNo
ORIGIN_NOT_ALLOWEDThis origin is not allowed to connectNo
ORIGIN_CATEGORY_DENIEDThis origin category is never allowed (file:, for example)No
REMOTE_SOURCE_DENIEDThe source device is outside the network allow-listNo
REMOTE_NATIVE_CLIENT_DENIEDA remote non-browser client without Origin was refusedNo
PROTOCOL_MISMATCHClient and PrintLink protocol versions differNo
RATE_LIMITEDToo many calls; temporarily throttledYes
AGENT_SHUTTING_DOWNThe service is shutting down and is not accepting jobsYes

Printers and profiles

CodeMeaningRetryable
PRINTER_NOT_FOUNDThe printer does not exist or was removedNo
PRINTER_OFFLINEThe printer is offline; the job was not submittedNo
PRINTER_BUSYThe printer is busyYes
CAPABILITIES_UNAVAILABLECapabilities cannot be read right nowYes
NATIVE_SETTINGS_UNAVAILABLEThis platform cannot open native settingsNo
PROFILE_INVALIDThe profile no longer matches the printer or driverNo
PROFILE_NOT_FOUNDNo such profileNo
PROFILE_PRINTER_MISMATCHThe profile does not match the target printerNo
CodeMeaningRetryable
UNSUPPORTED_PRINT_OPTIONAn option exceeds the printer's capabilitiesNo
INVALID_PAPER_SIZEInvalid or out-of-range paper sizeNo
COLOR_NOT_SUPPORTEDColour is not supportedNo
DUPLEX_NOT_SUPPORTEDDuplex is not supportedNo
TRAY_NOT_SUPPORTEDThe tray is unavailableNo
RESOLUTION_NOT_SUPPORTEDThe resolution is not supportedNo
WINDOWS_DEVMODE_REJECTEDThe driver rejected that combinationNo

Content

CodeMeaningRetryable
SOURCE_EMPTYsource.items is emptyNo
SOURCE_TOO_MANY_ITEMSToo many items (max 50, of which at most 10 HTML)No
DOCUMENT_INVALIDThe template document failed validationNo
DOCUMENT_SCHEMA_UNSUPPORTEDUnsupported document schema versionNo
PDF_INVALIDThe PDF is invalid or unparsableNo
IMAGE_DECODE_FAILEDThe image could not be decodedNo
HTML_INVALIDInvalid HTML asset, or wrong MIME / sizeNo
HTML_SNAPSHOT_UNAVAILABLEThis environment cannot snapshot web pagesNo
HTML_SNAPSHOT_TIMEOUTThe snapshot timed outNo
HTML_SNAPSHOT_TOO_MANY_PAGESOne HTML item exceeded 50 pagesNo
FONT_NOT_FOUNDA referenced font is unavailableNo
RENDER_FAILEDRendering the final artefact failedNo
ASSET_NOT_FOUND / ASSET_HASH_MISMATCHAsset missing / hash mismatchNo
UPLOAD_INVALIDInvalid or oversized uploadNo
PAYLOAD_TOO_LARGEThe request body is too largeNo
CONTENT_EXPIRED / CONTENT_NOT_RETAINEDContent expired / not retainedNo
PREVIEW_NOT_FOUND / PREVIEW_UNAVAILABLENo such preview / preview unavailableNo

Jobs

CodeMeaningRetryable
JOB_NOT_FOUNDNo such jobNo
JOB_CANNOT_CANCELThe current state cannot be cancelledNo
SPOOL_SUBMIT_FAILEDSubmitting to the system print queue failedNo
PRINT_FAILEDPrinting failedNo
QUEUE_FULLThe job queue is fullYes
AGENT_STOPPED_BEFORE_FINISHThe service stopped before the job finishedNo
OS_SHUTDOWN_TIMEOUTThe system shutdown wait timed outNo
WINDOWS_SPOOLER_UNAVAILABLEThe Windows print spooler is unavailableYes
WINDOWS_PRINTER_ACCESS_DENIEDWindows denied access to that printerNo

Scanning

CodeMeaningRetryable
SCANNER_NOT_FOUND / SCANNER_OFFLINENo such scanner / offlineNo
SCANNER_BUSYThe device or this site already has a scan runningYes
SCANNER_CAPABILITIES_UNAVAILABLEThe device returned no capabilitiesYes
SCANNER_BACKEND_UNAVAILABLENo scanning backend is availableNo
UNSUPPORTED_SCAN_OPTIONParameters exceed the device's capabilitiesNo
SCAN_DISABLEDScanning is switched off in settingsNo
SCAN_CONSENT_DENIEDThe user refused this scanNo
SCAN_CONSENT_TIMEOUTDesktop confirmation timed out; the job was cancelledYes
SCAN_SOURCE_EMPTYThe feeder is emptyYes
SCAN_DEVICE_ERRORThe device reported an error mid-scan (jam, cover open)No
SCAN_TRANSFER_FAILEDTransferring the result failedYes
SCAN_TOO_LARGE / SCAN_TIMEOUTPage, size or duration limit reachedNo / Yes
SCAN_NOT_FOUNDNo such job, or it is not this site'sNo
SCAN_CANNOT_CANCELAlready terminal; cannot be cancelledNo

System and devices

CodeMeaningRetryable
INVALID_REQUESTMalformed requestNo
METHOD_NOT_FOUNDNo such methodNo
UNSUPPORTEDNot supported on this platform or versionNo
INTERNALInternal errorYes
PORT_UNAVAILABLEThe new port cannot be bound (the old service keeps running)No
PORT_MIGRATION_FAILEDListener migration failed and was rolled backNo
LISTEN_SCOPE_BIND_FAILEDAn address in the chosen scope cannot be boundNo
UNSAFE_CONFIG_REJECTEDThe configuration violates a security floorNo
POLICY_LOCKED / POLICY_INVALIDLocked by machine policy / invalid policy fileNo
DEVICE_NOT_FOUND / DEVICE_PAYLOAD_INVALIDNo such raw device / payload validation failedNo
DEVICE_TRANSPORT_FAILEDDevice transport failedYes
DEVICE_PROTOCOL_UNSUPPORTEDDevice protocol unsupportedNo
CONTENT_UNSUPPORTED / CONTENT_OPEN_FAILEDContent cannot be shown safely / opening failedNo

The two remote-fetch errors

A failed remote fetch is REMOTE_FETCH_DENIED (the target is not public or violates a restriction) or REMOTE_FETCH_TOO_LARGE (the response is too large). Messages contain only the source category, never the address or full URL.

Warnings (not errors)

These appear in the warnings[] of a successful result. Show them to the user; do not treat them as failures.

CodeMeaning
UNSUPPORTED_PRINT_OPTIONThe option is unsupported and was ignored or downgraded
OPTION_IGNOREDThe driver discarded the option
PAGE_LAYOUT_EMULATEDA job-level fill was emulated in software
PAGE_RANGE_CLAMPEDThe page range partly overflowed and was clamped
MIXED_PAGE_SIZES_UNIFIEDNo paper given and content sizes differed; the largest was used
PAPER_DEFAULTEDNo paper given and none could be derived; the printer default was used
MEDIA_TYPE_UNVERIFIEDThe printer reports no media types, so the value cannot be confirmed
BINDING_MISSINGA template placeholder has no matching data path
BINDING_VALUE_INVALIDAn image binding value was invalid; the static image was used
HTML_SNAPSHOT_UNAVAILABLEThe web snapshot is unavailable (as a warning)
HIPRINT_*Hiprint conversion downgrades, see Hiprint templates

See also

On this page