---
title: fastly.error
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/variables/miscellaneous/fastly-error
---

**Type:** STRING  
**Access:** can be read and unset, but not set

**Available in:** all subroutines

Contains the last error code raised, otherwise _not set_.

Some functions that can raise errors don't unset `fastly.error` upon being
called. When error-checking an important operation, you can ensure you're
responding only to relevant errors by unsetting `fastly.error` beforehand:

```vcl
declare local var.key STRING = ...;
declare local var.iv STRING = ...;
declare local var.ciphertext STRING = ...;
declare local var.plaintext STRING;

# ... unrelated calls that may produce errors ...

# Clear fastly.error before an important operation
unset fastly.error;
set var.plaintext = crypto.decrypt_hex(aes256, cbc, nopad, var.key, var.iv, var.ciphertext);

# If fastly.error is set here, we're certain it's due to the call we're concerned with
if (fastly.error == "EBADDECRYPT") {
  error 403 "Wrong key";
} else if (fastly.error) {
  error 503;
}
```

## States

| Value         | Description                                                                                                                                                                                                                                                       |
| :------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `EBADDECRYPT` | Decryption failed. Produced when the wrong key or IV are used.                                                                                                                                                                                                    |
| `EPARSENUM`   | Number parsing failed. Claimed to be produced by `std.strtol()` but currently not possible.                                                                                                                                                                       |
| `ERANGE`      | Numerical result out of range.                                                                                                                                                                                                                                    |
| `EREG`        | Call to regex routine failed (generic).                                                                                                                                                                                                                           |
| `EREGRECUR`   | Call to regex routine failed because of recursion limits.                                                                                                                                                                                                         |
| `EREGSUB`     | Call to regex routine failed (generic).                                                                                                                                                                                                                           |
| `ESESOOM`     | Out of workspace memory.                                                                                                                                                                                                                                          |
| `EDOM`        | Domain error. This occurs for a mathematical function which is not defined for a particular value; formally, that value is not considered part of its input _domain_. For example, division by zero, or `var.x %= 5;` where `var.x` is a floating point infinity. |
| `ESYNTHOOM`   | Synthetic response overflow.                                                                                                                                                                                                                                      |
| `EUTF8`       | Invalid UTF-8.                                                                                                                                                                                                                                                    |
| `EUNAVAIL`    | Data temporarily unavailable.                                                                                                                                                                                                                                     |
| `EINVAL`      | Invalid argument.                                                                                                                                                                                                                                                 |
