> ## Documentation Index
> Fetch the complete documentation index at: https://docs.canton.network/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> If you are building a Canton Network application, start from https://docs.canton.network/appdev/quickstart.md. To run only a local network for your own Daml code, without building the QuickStart demo, see https://docs.canton.network/sdks-tools/development-tools/localnet.md.

# DA.Fail

> Reference documentation for Daml module DA.Fail.

Daml module

# DA.Fail

Fail, for FailureStatus

Daml

[Updated 3.5.1](#history-updated-3-5-1)

Module
DA.Fail

Latest release
3.7.5

## Data Types

### `data FailureCategory`

The category of the failure, which determines the status code and log
level of the failure. Maps 1-1 to the Canton error categories documented
here: [https://docs.digitalasset.com/operate/3.4/reference/error\_codes.html#error-categories-inventory](https://docs.digitalasset.com/operate/3.4/reference/error_codes.html#error-categories-inventory)

If you are more familiar with gRPC error codes, you can use the synonyms referenced in the
comments.

Constructors:

* `InvalidIndependentOfSystemState`

Use this to report errors that are independent of the current state of the ledger,
and should thus not be retried.

Corresponds to the gRPC status code `INVALID_ARGUMENT`.

See [https://docs.digitalasset.com/operate/3.4/reference/error\_codes.html#invalidindependentofsystemstate](https://docs.digitalasset.com/operate/3.4/reference/error_codes.html#invalidindependentofsystemstate)
for more information.

* `InvalidGivenCurrentSystemStateOther`

Use this to report errors that are due to the current state of the ledger,
but might disappear if the ledger state changes. Clients should retry these
requests after reading updated state from the ledger.

Corresponds to the gRPC status code `FAILED_PRECONDITION`.

See [https://docs.digitalasset.com/operate/3.4/reference/error\_codes.html#error-categories-inventory](https://docs.digitalasset.com/operate/3.4/reference/error_codes.html#error-categories-inventory)
for more information.

Instances:

* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `category` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)
* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `category` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)
* instance `Serializable` [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)
* instance [`Eq`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-eq-22713) [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)
* instance [`Ord`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)
* instance [`Show`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-show-show-65360) [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)

### `data FailureStatus`

Constructors:

* `FailureStatus`

**errorId** `Text`

Unambiguous identifier of the error.

SHOULD be prefixed with the DNS name identifying the app provider

or the API standard defining the error. For example,

`splice.lfdecentralizedtrust.org/insufficient-funds` could be used for

reporting an out of funds error in the context of the CN token standards.

**category** `FailureCategory`

Category of the failure, which determines how clients are expected to handle the error.

**message** `Text`

Developer-facing error message, which should be in English.

**meta** `TextMap Text`

Machine-readable metadata about the error in a key-value format.

Use this to provide extra context to clients for errors.

SHOULD be less than \< 512 characters as it MAY be truncated otherwise.

Instances:

* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `category` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)
* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `errorId` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)
* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `message` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)
* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `meta` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) ([`TextMap`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-lf-textmap-11691) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952))
* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `category` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)
* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `errorId` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)
* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `message` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)
* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `meta` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) ([`TextMap`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-lf-textmap-11691) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952))
* instance `Serializable` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615)
* instance [`Eq`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-eq-22713) [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615)
* instance [`Ord`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615)
* instance [`Show`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-show-show-65360) [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615)

## Typeclasses

### `class Action m => ActionFailWithStatus m`

Methods:

* `failWithStatus` : [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) -> `m` `a`
  Fail with a failure status

Instances:

* instance [`ActionFailWithStatus`](#class-da-internal-fail-actionfailwithstatus-58664) [`Update`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-lf-update-68072)

## Functions

### `invalidArgument`

`invalidArgument` : [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)

Alternative name for `InvalidIndependentOfSystemState`.

### `failedPrecondition`

`failedPrecondition` : [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)

Alternative name for `InvalidGivenCurrentSystemStateOther`.

### `failWithStatusPure`

`failWithStatusPure` : [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) -> `a`

Fail with a failure status in a pure context

## Orphan Typeclass Instances

* instance [`Eq`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-eq-22713) [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615)

* instance [`Ord`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615)

* instance [`Show`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-show-show-65360) [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615)

* instance [`Eq`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-eq-22713) [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)

* instance [`Ord`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)

* instance [`Show`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-show-show-65360) [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)

* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `errorId` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)

* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `errorId` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)

* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `category` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)

* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `category` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`FailureCategory`](#type-da-internal-fail-types-failurecategory-97811)

* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `message` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)

* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `message` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952)

* instance [`GetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-getfield-53979) `meta` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) ([`TextMap`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-lf-textmap-11691) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952))

* instance [`SetField`](https://docs.canton.network/appdev/reference/daml-standard-library/da-record#class-da-internal-record-setfield-4311) `meta` [`FailureStatus`](#type-da-internal-fail-types-failurestatus-69615) ([`TextMap`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-lf-textmap-11691) [`Text`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-text-51952))

* instance [`ActionFail`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-da-internal-prelude-actionfail-34438) [`Update`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-lf-update-68072)

* instance [`CanAbort`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-da-internal-lf-canabort-29060) [`Update`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-da-internal-lf-update-68072)

## History

Updated
`3.5.1`

Module declarations or documentation updated.
