> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# Errors

> Error codes emitted by SWML during script execution, for both calling and messaging documents.

Reference for the error codes that SWML reports when a document fails to fetch, parse, or run.
Calling and messaging SWML use different code namespaces:

* **Calling errors** start with `relay_script_*` and surface on the call session as the
  `script_error` variable and as `calling.script.warning` events.
* **Messaging errors** include the `swml_*` codes for messaging-specific failures plus a handful of
  document-level codes. They appear on the inbound message in the
  [Messaging logs](/docs/apis/rest/message-logs/list-message-logs) and on any status callbacks you've
  configured.

## Calling errors

Errors raised while executing a calling SWML document. Each error is reported with a contextual
message describing the offending method, parameter, or condition. You can read the code from the
`script_error` variable on the call session or from the payload of the `calling.script.warning`
event.

The fetched document could not be parsed as valid JSON or YAML, or the `dest` URL of a `transfer`
was malformed.

An internal parsing error occurred while reading the document. Verify the document is valid
YAML or JSON and retry.

The document's `version` value is not a supported SWML version.

The document has no `sections` element.

The document's `sections` is missing the required `main` section.

A section is defined but contains no executable steps.

An `execute` step references a section that does not exist in the document.

An unrecognized top-level element appears in the document.

A document element has the wrong JSON type for its position (for example, an array where an
object was expected).

A document element has an invalid value (for example, an enum-valued field set to an unrecognized
string).

A document element that may appear at most once was provided multiple times.

A step in a section does not have a method name (the step entry is malformed).

A step references a method that is not a recognized SWML calling method.

A required parameter for the method is missing — for example, `transfer` without `dest`, or
`request` without `url`.

A method parameter has an invalid value — for example, a `request.method` that is not one of
the supported HTTP verbs, or a `switch.variable` that does not resolve to a valid variable name.

A method received a parameter name it does not recognize.

Two mutually-exclusive parameters were provided on the same method.

A `switch` step matched no `case` and no `default` was provided.

A method failed while running — for example, a media playback failure, a transfer that couldn't
dial, or a tap or stream that couldn't be set up. The accompanying message provides the specific
cause.

A JavaScript expression in a `cond`, `switch`, `eval`, or `when` clause raised an error.

A document or one of its sections is nested beyond the maximum depth.

The chain of `transfer` and `goto` steps exceeded the platform maximum (32 transfers per call).

An internal server error occurred during script execution.

## Messaging errors

Errors emitted when an inbound message's SWML document fails to fetch, parse, or execute. Each
inbound message is marked `failed` with the listed `error_code` and a corresponding
`error_message`, visible in the [Messaging logs](/docs/apis/rest/message-logs/list-message-logs).

### Document fetch / route

Unrouteable message received — no SWML handler is assigned to the inbound number.

Insufficient account balance to receive the message.

Message filtered (e.g. spam detection or carrier-level filtering).

The attempt to retrieve the SWML document timed out or failed.

The configured SWML URL could not be parsed.

### Document parse

The document must be valid JSON or YAML.

Document may contain only one of `reply`, `receive`, or `sections` at the top level.

Document must contain `reply`, `receive`, or `sections`.

Section `main` must be an array of steps.

The document references an unsupported SWML messaging method.

### `reply` method

Failed to create the reply message (general fallback for reply persistence errors).

The reply exceeds the maximum of 8 media attachments.

The reply must include a `body` or `media`.

The reply `from` number is not a valid PhoneRoute or ShortCode in this project.

The reply `to` number has an invalid format.

The reply `from` number is not SMS- or MMS-capable for the kind of message being sent.

The reply body exceeds the character limit for the destination.

The reply `from` number must belong to an active 10DLC campaign.

### `switch` method

`switch` matched no `case` and no `default` was provided.

`switch.transform` is not one of `lowercase`, `uppercase`, `trim`, `lowercase_trim`,
`uppercase_trim`.

### `execute` method

The section named by `execute.dest` is not defined in the current document.

### `transfer` method

`transfer.dest` is required and was missing or empty.

Failed to fetch the transferred SWML document from the destination URL.

The transferred SWML document is not a valid messaging document.

### `goto` method

`goto.label` does not match any `label` step in the current section.

### `request` method

`request.url` is required and was missing or empty.