--- title: "Errors reference" description: "Every error class Slate throws: the three public Camera errors and their kinds, the PTP protocol errors, their fields, when each is thrown and what to do." url: https://darkgrade.com/docs/slate/reference/errors last_updated: 2026-12-04 docs_index: https://darkgrade.com/docs/llms.txt --- # Errors reference > Every error class Slate throws: the three public Camera errors and their kinds, the PTP protocol errors, their fields, when each is thrown and what to do. > ## Documentation Index > Fetch the complete documentation index at: https://darkgrade.com/docs/llms.txt > Use this file to discover all available pages before exploring further. A `Camera` operation fails in one of three ways, and the class tells you what happened to the camera: nothing was sent, the camera said no, or the command went out and was not confirmed. Branch on the class, never on the message. ```typescript import { CameraOutcomeUnknownError, CameraRefusedError, CameraUnsupportedError, } from '@darkgrade/slate' try { await camera.setIso('ISO 800') } catch (error) { if (error instanceof CameraUnsupportedError) { // Nothing was sent: no ISO setting in this mode. } else if (error instanceof CameraRefusedError) { // Nothing changed: offer the values listed now. const { controls } = await camera.getCapabilities() console.log(controls.iso?.allowedValues) } else if (error instanceof CameraOutcomeUnknownError) { // Sent, not confirmed, never resent: read first. console.log(await camera.getIso(), error.cause) } else throw error } ``` Guide: [Errors and recovery](https://darkgrade.com/docs/slate/guides/errors.md) ## Camera errors | Error | Meaning | | - | - | | [`CameraUnsupportedError`](#cameraunsupportederror) | This camera cannot do it right now; [`getCapabilities()`](https://darkgrade.com/docs/slate/getting_started/camera.md#getcapabilities) says why. Nothing was sent. | | [`CameraRefusedError`](#camerarefusederror) | The camera said no, or the value is not one it offers now. Nothing changed. | | [`CameraOutcomeUnknownError`](#cameraoutcomeunknownerror) | The command was sent but its result could not be confirmed. It is never resent, so a photo, a stop or a setting write is never repeated by accident; read the camera again before retrying. | | [`CameraConfirmationError`](#cameraconfirmationerror) | An acknowledged request whose fresh camera observation did not confirm the requested state. | | [`CameraClipNotFoundError`](#cameraclipnotfounderror) | The camera confirmed it stopped recording, but no new finished clip appeared on the card in time. Stop is not resent; any footage stays on the card, where listing the card finds it later. | Each carries `operation`, so a host can say which request failed without reading the message. An argument of the wrong shape is not a camera outcome: `connect()` and `on()` throw a plain `TypeError` for one, before anything is sent. A failed device selection before any command (no matching USB device, or several) is rethrown as it is. ### How connection failures become these errors [`connect`](https://darkgrade.com/docs/slate/getting_started/camera.md#connect), [`getInfo`](https://darkgrade.com/docs/slate/getting_started/camera.md#getinfo), [`recover`](https://darkgrade.com/docs/slate/getting_started/camera.md#recover) and [`disconnect`](https://darkgrade.com/docs/slate/getting_started/camera.md#disconnect) report a failure as one of the three public error types, keeping the driver's error as `cause`: a PTP response the camera refused becomes [CameraRefusedError](https://darkgrade.com/docs/slate/reference/errors.md#camerarefusederror); a timeout, lost transport, unreadable reply, pending recovery or failed cleanup becomes [CameraOutcomeUnknownError](https://darkgrade.com/docs/slate/reference/errors.md#cameraoutcomeunknownerror), since the session's state was not confirmed. Device selection failures before any command (no matching USB device, several matches) and invalid arguments are not camera outcomes and are rethrown unchanged. ## Protocol errors The failures of the connection under a `Camera`: a cable, a transport or a camera that misbehaves. They reach you directly from raw calls on `protocolSession(camera)`, and as the `cause` of a Camera error. Every one carries the operation and transaction it happened in. | Error | Meaning | | - | - | | [`PTPError`](#ptperror) | The base class of every protocol failure. Catch it to handle all of them at once. | | [`PTPDecodeError`](#ptpdecodeerror) | A dataset arrived intact at the container level but could not be decoded. | | [`PTPDisconnectedError`](#ptpdisconnectederror) | The transport is gone (cable pulled, camera powered off, socket closed). Reconnect to continue. | | [`PTPProtocolError`](#ptpprotocolerror) | The camera answered with bytes that break ISO 15740 container framing for this transaction. | | [`PTPRecoveryRequiredError`](#ptprecoveryrequirederror) | The pipe may still contain an abandoned transaction and the automatic USB reset failed, or the transport has none (PTP/IP). Commands stay blocked until a disconnect/connect or caller-owned recovery. | | [`PTPResponseError`](#ptpresponseerror) | The camera answered a transaction with a response code the caller cannot continue from. | | [`PTPTimeoutError`](#ptptimeouterror) | A transport phase did not complete in time. The camera may still be busy with the transaction. | ## CameraUnsupportedError extends Error This camera cannot do it right now; [`getCapabilities()`](https://darkgrade.com/docs/slate/getting_started/camera.md#getcapabilities) says why. Nothing was sent. **When** The connected camera has no such operation, cannot do it in its current mode, or cannot do an option you asked for. A typed getter also throws it when the setting is absent on this camera, does not apply now, or holds a value Slate has no name for. **What to do** For a method, [`getCapabilities().operations[error.operation]`](https://darkgrade.com/docs/slate/getting_started/camera.md#getcapabilities) has the `reason`, in words you can show a person; for a setting, `getCapabilities().controls[error.operation]` shows whether it is present, `enabled` and `writable`. Nothing was sent, so calling again once the mode, lens or card changes is safe. **`operation`** · `string` The method name or setting id that failed. **`message`** · `string` What happened, in words you can show a person. **`cause?`** · `unknown` The transport or protocol error behind it, when one caused it. ## CameraRefusedError extends Error The camera said no, or the value is not one it offers now. Nothing changed. **When** The camera answered no, the value is not one of the setting's `allowedValues` now, or an argument was malformed (a [`takePhoto`](https://darkgrade.com/docs/slate/getting_started/camera.md#takephoto) option, a preview size, an invalid `Date`). `takePhoto` is also refused while the camera records. **What to do** Nothing changed. Read [`getCapabilities()`](https://darkgrade.com/docs/slate/getting_started/camera.md#getcapabilities) for the values offered now and choose one of them, or fix the argument, then call again. **`operation`** · `string` The method name or setting id that failed. **`message`** · `string` What happened, in words you can show a person. **`cause?`** · `unknown` The transport or protocol error behind it, when one caused it. ## CameraOutcomeUnknownError extends Error The command was sent but its result could not be confirmed. It is never resent, so a photo, a stop or a setting write is never repeated by accident; read the camera again before retrying. **When** The command went out and its result could not be confirmed: a timeout, a lost connection, an unreadable reply, a photo whose file never appeared, a lens that did not reach the focal length asked for. **What to do** Slate never resends, and neither should you without looking. Read the camera first ([`getCapabilities()`](https://darkgrade.com/docs/slate/getting_started/camera.md#getcapabilities), [`listMedia()`](https://darkgrade.com/docs/slate/getting_started/camera.md#listmedia), [`getRecordingState()`](https://darkgrade.com/docs/slate/getting_started/camera.md#getrecordingstate)), then decide. `error.cause` holds the transport or protocol error when one is behind it. **`operation`** · `string` The method name or setting id that failed. **`message`** · `string` What happened, in words you can show a person. **`cause?`** · `unknown` The transport or protocol error behind it, when one caused it. ## CameraConfirmationError extends CameraOutcomeUnknownError › Error **When** The camera acknowledged a setting write, or a recording start or stop, but a fresh read did not show the requested state in time. `operation` is the setting's id, or `record_start` or `record_stop`. **What to do** Compare `expected` with `observed`, read [`getCapabilities()`](https://darkgrade.com/docs/slate/getting_started/camera.md#getcapabilities) again, and only then write again. **`operation`** · `string` The method name or setting id that failed. **`expected`** · `string` The value or state that was asked for. **`observed`** · `string | null` What the camera showed instead; `null` when it showed nothing. **`message`** · `string` What happened, in words you can show a person. **`cause?`** · `unknown` The transport or protocol error behind it, when one caused it. ## CameraClipNotFoundError extends CameraOutcomeUnknownError › Error **When** [`stopRecording()`](https://darkgrade.com/docs/slate/getting_started/camera.md#stoprecording) saw the camera stop, but no new finished clip appeared on the card in time. **What to do** Stop is not resent and the footage stays on the card: [`listMedia()`](https://darkgrade.com/docs/slate/getting_started/camera.md#listmedia) finds it later. **`operation`** · `string` The method name or setting id that failed. Inherited from [`CameraOutcomeUnknownError`](https://darkgrade.com/docs/slate/reference/errors.md#cameraoutcomeunknownerror). **`message`** · `string` What happened, in words you can show a person. **`cause?`** · `unknown` The transport or protocol error behind it, when one caused it. ## PTPError extends Error **When** The base class of every protocol failure. Catch it to handle all of them at once. **What to do** Branch on the subclass. `operation` and `transactionId` say which transaction failed. **`operation?`** · `string` The PTP operation of the transaction that failed, when known. **`transactionId?`** · `number` The transaction it happened in, when known. **`message`** · `string` What happened, in words you can show a person. **`cause?`** · `unknown` The lower-level error behind it, when there is one. ## PTPDecodeError extends PTPError › Error **When** A dataset arrived whole but could not be decoded. **What to do** The session is still usable. The camera sent a shape Slate does not know; report the model and firmware. **`operation?`** · `string` The PTP operation of the transaction that failed, when known. Inherited from [`PTPError`](https://darkgrade.com/docs/slate/reference/errors.md#ptperror). **`transactionId?`** · `number` The transaction it happened in, when known. Inherited from [`PTPError`](https://darkgrade.com/docs/slate/reference/errors.md#ptperror). **`message`** · `string` What happened, in words you can show a person. **`cause?`** · `unknown` The lower-level error behind it, when there is one. ## PTPDisconnectedError extends PTPError › Error **When** The transport is gone: the cable was pulled, the camera powered off, or the socket closed. **What to do** Call [`connect()`](https://darkgrade.com/docs/slate/getting_started/camera.md#connect) again once the camera is back. **`operation?`** · `string` The PTP operation of the transaction that failed, when known. Inherited from [`PTPError`](https://darkgrade.com/docs/slate/reference/errors.md#ptperror). **`transactionId?`** · `number` The transaction it happened in, when known. Inherited from [`PTPError`](https://darkgrade.com/docs/slate/reference/errors.md#ptperror). **`message`** · `string` What happened, in words you can show a person. **`cause?`** · `unknown` The lower-level error behind it, when there is one. ## PTPProtocolError extends PTPError › Error **When** The camera answered with bytes that break PTP container framing. `violation` names how. **What to do** Treat the session as out of step: disconnect and connect again, or call [`recover()`](https://darkgrade.com/docs/slate/getting_started/camera.md#recover). **`violation`** · `PTPProtocolViolation` How the reply broke the framing. See [`PTPProtocolViolation`](https://darkgrade.com/docs/slate/reference/types-workflow.md#ptpprotocolviolation). **`operation?`** · `string` The PTP operation of the transaction that failed, when known. Inherited from [`PTPError`](https://darkgrade.com/docs/slate/reference/errors.md#ptperror). **`transactionId?`** · `number` The transaction it happened in, when known. Inherited from [`PTPError`](https://darkgrade.com/docs/slate/reference/errors.md#ptperror). **`message`** · `string` What happened, in words you can show a person. **`cause?`** · `unknown` The lower-level error behind it, when there is one. ## PTPRecoveryRequiredError extends PTPError › Error **When** An abandoned transaction may still be in the pipe and the automatic USB reset failed, or the transport has none (PTP/IP). Every command fails with it until the session is replaced. **What to do** Call [`disconnect()`](https://darkgrade.com/docs/slate/getting_started/camera.md#disconnect) then [`connect()`](https://darkgrade.com/docs/slate/getting_started/camera.md#connect), or [`recover()`](https://darkgrade.com/docs/slate/getting_started/camera.md#recover). **`operation?`** · `string` The PTP operation of the transaction that failed, when known. Inherited from [`PTPError`](https://darkgrade.com/docs/slate/reference/errors.md#ptperror). **`transactionId?`** · `number` The transaction it happened in, when known. Inherited from [`PTPError`](https://darkgrade.com/docs/slate/reference/errors.md#ptperror). **`message`** · `string` What happened, in words you can show a person. **`cause?`** · `unknown` The lower-level error behind it, when there is one. ## PTPResponseError extends PTPError › Error **When** The camera answered with a response code the caller cannot continue from. `code` is the PTP response code. **What to do** Look the code up in the [response definitions](https://darkgrade.com/docs/slate/ptp-reference/response-definitions.md). On the connection operations it becomes [CameraRefusedError](https://darkgrade.com/docs/slate/reference/errors.md#camerarefusederror). **`code`** · `number` The PTP response code the camera answered with. **`operation?`** · `string` The PTP operation of the transaction that failed, when known. Inherited from [`PTPError`](https://darkgrade.com/docs/slate/reference/errors.md#ptperror). **`transactionId?`** · `number` The transaction it happened in, when known. Inherited from [`PTPError`](https://darkgrade.com/docs/slate/reference/errors.md#ptperror). **`message`** · `string` What happened, in words you can show a person. **`cause?`** · `unknown` The lower-level error behind it, when there is one. ## PTPTimeoutError extends PTPError › Error **When** A send, data or response phase did not complete within the transaction policy. `phase` says which. **What to do** The camera may still be working on the transaction. On USB, Slate resets the pipe before the next command unless `automaticUSBReset` is off; raise `timeoutMilliseconds` in `transactionPolicy` for slow operations. **`phase`** · `'send' | 'data' | 'response'` The phase of the transaction that timed out. **`timeoutMilliseconds`** · `number` How long Slate waited. **`operation?`** · `string` The PTP operation of the transaction that failed, when known. Inherited from [`PTPError`](https://darkgrade.com/docs/slate/reference/errors.md#ptperror). **`transactionId?`** · `number` The transaction it happened in, when known. Inherited from [`PTPError`](https://darkgrade.com/docs/slate/reference/errors.md#ptperror). **`message`** · `string` What happened, in words you can show a person. **`cause?`** · `unknown` The lower-level error behind it, when there is one. ## Errors of other entry points Thrown by code outside `Camera`, and exported from the [entry point](https://darkgrade.com/docs/slate/reference/entry-points.md) named. | Error | Import from, and meaning | | - | - | | `PTPIPTransactionCancelledError` | `@darkgrade/slate/protocol` A wire Cancel is a cancelled transaction, never an invented PTP response code. | | `HardwareBusyError` | `@darkgrade/slate/runtime` Another operation or process holds the camera. Carries `status` (409), `code` (`HARDWARE_BUSY`) and `retryAfterMilliseconds`. | | `OperationInputError` | `@darkgrade/slate/runtime` A call's inputs do not match the operation's parameters; nothing was sent to a camera. | | `TelemetryError` | `@darkgrade/slate/telemetry/server` The collector refuses a request: `status` is the HTTP status to answer with, `retryAfterSeconds` when to try again. | | `InvalidMatrixCursor` | `@darkgrade/slate/telemetry/server` A page of the Matrix export was asked for with a cursor the collector cannot read. | | `MatrixExportChanged` | `@darkgrade/slate/telemetry/server` The Matrix export changed or expired between pages: restart the synchronisation from its first page. | ## Related > [card] [Camera](https://darkgrade.com/docs/slate/getting_started/camera.md) > > The class: constructor, every method, what each returns and throws. > [card] [Settings](https://darkgrade.com/docs/slate/reference/settings.md) > > Every setting id with its values, getter, setter and vendor properties. > [card] [Types](https://darkgrade.com/docs/slate/reference/types.md) > > Every exported type, field by field. > [card] [Entry points](https://darkgrade.com/docs/slate/reference/entry-points.md) > > Every import path of the package and what it exports.