---
isPrivate: true
title: (LEGACY) Errors
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Observability Pipelines > (LEGACY) Observability Pipelines
  Documentation > Reference > (LEGACY) Datadog Processing Language / Vector
  Remap Language > (LEGACY) Errors
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# (LEGACY) Errors

Datadog Processing Language (DPL), or Vector Remap Language (VRL), is a fail-safe language, which means that a DPL/VRL program does not compile unless all potential errors are handled. This ensures that your DPL/VRL programs can handle malformed data.

## Compile-time errors{% #compile-time-errors %}

### 100 Unhandled root runtime error{% #unhandled-root-runtime-error %}

A root expression is fallible and its runtime error isn't handled in the DPL program.

#### Rationale{% #unhandled-root-runtime-error-rationale %}

DPL is fail safe and thus requires that all possible runtime errors be handled. This provides important safety guarantees to DPL and helps to ensure that DPL programs run reliably when deployed.

#### Resolution{% #unhandled-root-runtime-error-resolution %}

Handle the runtime error by assigning, coalescing, or raising the error.

#### Examples{% #unhandled-root-runtime-error-examples %}

##### Unhandled root runtime error (assigning){% #unhandled-root-runtime-error-assigning %}

DPL program:

```bash
get_env_var("HOST")
```

How to fix it:

```diff
- 	get_env_var("HOST")
+# 	.host = get_env_var("HOST")
```

### 101 Malformed regex literal{% #malformed-regex-literal %}

A regex literal expression is malformed and thus doesn't result in a valid regular expression.

#### Rationale{% #malformed-regex-literal-rationale %}

Invalid regular expressions don't compile.

#### Resolution{% #malformed-regex-literal-resolution %}

Regular expressions are difficult to write and commonly result in syntax errors. If you're parsing a common log format we recommend using one of DPL's `parse_*` functions. If you don't see a function for your format please request it. Otherwise, use the Rust regex tester to test and correct your regular expression.

#### Examples{% #malformed-regex-literal-examples %}

##### Malformed regex literal (common format){% #malformed-regex-literal-common-format %}

DPL program:

```bash
. |= parse_regex!(.message, r'^(?P<host>[\w\.]+) - (?P<user>[\w]+) (?P<bytes_in>[\d]+) \[?P<timestamp>.*)\] "(?P<method>[\w]+) (?P<path>.*)" (?P<status>[\d]+) (?P<bytes_out>[\d]+)$')
```

How to fix it:

```diff
-. |= parse_regex!(.message, r'^(?P<host>[\w\.]+) - (?P<user>[\w]+) (?P<bytes_in>[\d]+) \[?P<timestamp>.*)\] "(?P<method>[\w]+) (?P<path>.*)" (?P<status>[\d]+) (?P<bytes_out>[\d]+)$')
+. |= parse_common_log!(.message)
```

### 102 Non-boolean if expression predicate{% #non-boolean-if-expression-predicate %}

An if expression predicate doesn't evaluate to a Boolean.

#### Rationale{% #non-boolean-if-expression-predicate-rationale %}

DPL doesn't implement "truthy" values (non-Boolean values that resolve to a Boolean, such as `1`) since these are common foot-guns that can result in unexpected behavior when used in if expressions. This provides important safety guarantees in DPL and ensures that DPL programs are reliable once deployed.

#### Resolution{% #non-boolean-if-expression-predicate-resolution %}

Adjust your if expression predicate to resolve to a Boolean. Helpful functions to solve this include `exists` and `is_nullish`.

#### Examples{% #non-boolean-if-expression-predicate-examples %}

##### Non-boolean if expression predicate (strings){% #non-boolean-if-expression-predicate-strings %}

DPL program:

```bash
if .message {
	. |= parse_key_value!(.message)
}
```

How to fix it:

```diff
-if .message {
+if exists(.message) {
 	. |= parse_key_value!(.message)
 }
```

### 103 Unhandled fallible assignment{% #unhandled-fallible-assignment %}

The right-hand side of this assignment is fallible (that is, it can produce a runtime error), but the error isn't handled.

#### Rationale{% #unhandled-fallible-assignment-rationale %}

DPL is fail safe and thus requires that all possible runtime errors be handled. This provides important safety guarantees to DPL and helps to ensure that DPL programs run reliably when deployed.

#### Resolution{% #unhandled-fallible-assignment-resolution %}

Handle the runtime error by either assigning it, coalescing it, or raising it.

#### Examples{% #unhandled-fallible-assignment-examples %}

##### Unhandled fallible assignment (coalescing){% #unhandled-fallible-assignment-coalescing %}

DPL program:

```bash
. = parse_key_value(.message)
```

How to fix it:

```diff
-. = parse_key_value(.message)
+. = parse_key_value(.message) ?? {}
```

##### Unhandled fallible assignment (raising){% #unhandled-fallible-assignment-raising %}

DPL program:

```bash
. = parse_key_value(.message)
```

How to fix it:

```diff
-. = parse_key_value(.message)
+. = parse_key_value!(.message)
```

##### Unhandled fallible assignment (assigning){% #unhandled-fallible-assignment-assigning %}

DPL program:

```bash
. = parse_key_value(.message)
```

How to fix it:

```diff
-. = parse_key_value(.message)
+., err = parse_key_value(.message)
```

### 104 Unnecessary error assignment{% #unnecessary-error-assignment %}

The left-hand side of an assignment expression needlessly handles errors even though the right-hand side *can't* fail.

#### Rationale{% #unnecessary-error-assignment-rationale %}

Assigning errors when one is not possible is effectively dead code that makes your program difficult to follow. Removing the error assignment simplifies your program.

#### Resolution{% #unnecessary-error-assignment-resolution %}

Remove the error assignment.

#### Examples{% #unnecessary-error-assignment-examples %}

##### Unnecessary error assignment (strings){% #unnecessary-error-assignment-strings %}

DPL program:

```bash
.message, err = downcase(.message)
```

How to fix it:

```diff
-.message, err = downcase(.message)
+.message = downcase(.message)
```

### 105 Undefined function{% #undefined-function %}

A function call expression invokes an unknown function.

#### Resolution{% #undefined-function-resolution %}

This is typically due to a typo. Correcting the function name should resolve this.

#### Examples{% #undefined-function-examples %}

##### Undefined function (typo){% #undefined-function-typo %}

DPL program:

```bash
parse_keyvalue(.message)
```

How to fix it:

```diff
-parse_keyvalue(.message)
+parse_key_value(.message)
```

### 106 Function argument arity mismatch{% #function-argument-arity-mismatch %}

A function call expression invokes a function with too many arguments.

#### Resolution{% #function-argument-arity-mismatch-resolution %}

Remove the extra arguments to adhere to the function's documented signature.

#### Examples{% #function-argument-arity-mismatch-examples %}

##### Function argument arity mismatch{% #function-argument-arity-mismatch %}

DPL program:

```bash
parse_json(.message, pretty: true)
```

How to fix it:

```diff
-parse_json(.message, pretty: true)
+parse_json(.message)
```

### 107 Required function argument missing{% #required-function-argument-missing %}

A function call expression fails to pass a required argument.

#### Resolution{% #required-function-argument-missing-resolution %}

Supply all of the required function arguments to adhere to the function's documented signature.

#### Examples{% #required-function-argument-missing-examples %}

##### Required function argument missing{% #required-function-argument-missing %}

DPL program:

```bash
parse_timestamp(.timestamp)
```

How to fix it:

```diff
-parse_timestamp(.timestamp)
+parse_timestamp(.timestamp, format: "%D")
```

### 108 Unknown function argument keyword{% #unknown-function-argument-keyword %}

A function call expression passes an unknown named argument.

#### Resolution{% #unknown-function-argument-keyword-resolution %}

Correct the name to align with the documented argument names for the function.

#### Examples{% #unknown-function-argument-keyword-examples %}

##### Unknown function argument keyword{% #unknown-function-argument-keyword %}

DPL program:

```bash
parse_timestamp(.timestamp, fmt: "%D")
```

How to fix it:

```diff
-parse_timestamp(.timestamp)
+parse_timestamp(.timestamp, format: "%D")
```

### 110 Invalid argument type{% #invalid-argument-type %}

An argument passed to a function call expression isn't a supported type.

#### Rationale{% #invalid-argument-type-rationale %}

DPL is fail safe and thus requires that all possible runtime errors be handled. This provides important safety guarantees to DPL and helps to ensure that DPL programs run reliably when deployed.

#### Resolution{% #invalid-argument-type-resolution %}

You must guarantee the type of the variable by using the appropriate type or coercion function.

#### Examples{% #invalid-argument-type-examples %}

##### Invalid argument type (guard with defaults){% #invalid-argument-type-guard-with-defaults %}

DPL program:

```bash
downcase(.message)
```

How to fix it:

```diff
+.message = string(.message) ?? ""
 downcase(.message)
```

##### Invalid argument type (guard with errors){% #invalid-argument-type-guard-with-errors %}

DPL program:

```bash
downcase(.message)
```

How to fix it:

```diff
downcase(string!(.message))
```

### 111 Unhandled predicate error{% #unhandled-predicate-error %}

A predicate is fallible and its runtime error isn't handled in the DPL program.

#### Rationale{% #unhandled-predicate-error-rationale %}

DPL is fail safe and thus requires that all possible runtime errors be handled. This provides important safety guarantees to DPL and helps to ensure that DPL programs run reliably when deployed.

#### Resolution{% #unhandled-predicate-error-resolution %}

Handle the runtime error by assigning, coalescing, or raising the error.

#### Examples{% #unhandled-predicate-error-examples %}

##### Unhandled predicate error (predicate){% #unhandled-predicate-error-predicate %}

DPL program:

```bash
if contains(.field, "thing") {
  log("thing")
}
```

How to fix it:

```diff
-       if contains(.field, "thing") {
+#      if contains(.field, "thing") ?? false {
```

### 203 Unrecognized token{% #unrecognized-token %}

Your DPL program contains a token (character) that the DPL parser doesn't recognize as valid.

#### Resolution{% #unrecognized-token-resolution %}

Use a valid token.

#### Examples{% #unrecognized-token-examples %}

##### Unrecognized token{% #unrecognized-token %}

DPL program:

```bash
😂
```

How to fix it:

```diff
-😂
+"some valid value"
```

### 204 Unrecognized end-of-file (EOF){% #unrecognized-end-of-file-eof %}

The DPL parser has reached the end of the program in an invalid state, potentially due to a typo or a dangling expression.

#### Resolution{% #unrecognized-end-of-file-eof-resolution %}

Make sure that the last expression in the program is valid.

#### Examples{% #unrecognized-end-of-file-eof-examples %}

##### Unrecognized end-of-file (EOF){% #unrecognized-end-of-file-eof %}

DPL program:

```bash
.field1 = "value1"
.field2 =
```

How to fix it:

```diff
-.bar =
+.field2 = "value2"
```

### 205 Reserved keyword{% #reserved-keyword %}

You've used a name for a variable that serves another purpose in DPL or is reserved for potential future use.

#### Resolution{% #reserved-keyword-resolution %}

Use a different variable name.

#### Examples{% #reserved-keyword-examples %}

##### Reserved keyword{% #reserved-keyword %}

DPL program:

```bash
else = "some value"
```

How to fix it:

```diff
-else = "some value"
+some_non_reserved_name = "some value"
```

### 206 Invalid numeric literal{% #invalid-numeric-literal %}

The DPL compiler doesn't recognize this numeric literal as valid.

### 207 Invalid string literal{% #invalid-string-literal %}

Your DPL program contains a string literal that the DPL parser doesn't recognize as valid.

#### Resolution{% #invalid-string-literal-resolution %}

Make sure that your string is properly enclosed by single or double quotes.

#### Examples{% #invalid-string-literal-examples %}

##### Invalid string literal{% #invalid-string-literal %}

DPL program:

```bash
"Houston, we have a problem'
```

How to fix it:

```diff
- "Houston, we have a problem'
+ "Houston, we have a problem"
```

### 208 Invalid literal{% #invalid-literal %}

The DPL compiler doesn't recognize this literal value as valid.

### 209 Invalid escape character{% #invalid-escape-character %}

Your string includes an escape character that the DPL compiler doesn't recognize as valid

### 300 Unexpected type{% #unexpected-type %}

The DPL compiler expected a value of a specific type but found a different type.

### 301 Type coercion error{% #type-coercion-error %}

This value can't be coerced into the desired type.

### 302 Remainder error{% #remainder-error %}

These two types can't produce a remainder.

### 303 Multiplication error{% #multiplication-error %}

These types can't be multiplied together

### 304 Division error{% #division-error %}

The left-hand value can't be divided by the right-hand value.

### 305 Divide by zero{% #divide-by-zero %}

You've attempted to divide an integer or float by zero.

#### Rationale{% #divide-by-zero-rationale %}

Unlike some other programming languages, DPL doesn't have any concept of infinity, as it's unclear how that could be germane to observability data use cases. Thus, dividing by zero can't have any meaningful result.

#### Resolution{% #divide-by-zero-resolution %}



If you know that a value is necessarily zero, don't divide by it. If a value *could* be zero, capture the potential error thrown by the operation:

```coffee
result, err = 27 / .some_value
if err != null {
	# Handle error
}
```



### 306 NaN float{% #nan-float %}

Floats in DPL can't be NaN (not a number).

### 307 Addition error{% #addition-error %}

These two values can't be added together.

### 308 Subtraction error{% #subtraction-error %}

The right-hand value can't be subtracted from the left-hand value.

### 309 Or expression error{% #or-expression-error %}

These two values can't be combined into an or expression.

### 310 And expression error{% #and-expression-error %}

These two values can't be combined into an and expression.

### 311 Greater than error{% #greater-than-error %}

These two values can't be used in a greater than expression.

### 312 Greater than or equal to error{% #greater-than-or-equal-to-error %}

These two values can't be used in a greater than or equal to expression.

### 313 Less than error{% #less-than-error %}

These two values can't be used in less than expression.

### 314 Less than or equal to error{% #less-than-or-equal-to-error %}

These two values can't be used in a less than or equal to expression.

### 315 mutation of read-only value{% #mutation-of-read-only-value %}

This value is read-only and cannot be deleted or mutated.

### 400 Unexpected expression{% #unexpected-expression %}

The DPL compiler encountered an expression type that wasn't expected here.

### 401 Invalid enum variant{% #invalid-enum-variant %}

DPL expects an enum value for this argument, but the value you entered for the enum is invalid.

#### Resolution{% #invalid-enum-variant-resolution %}

Check the documentation for this function in the DPL functions reference to see which enum values are valid for this argument.

### 402 Expected static expression for function argument{% #expected-static-expression-for-function-argument %}



DPL expected a static expression for a function argument, but a dynamic one was provided (such as a variable).

DPL requires static expressions for some function arguments to validate argument types at compile time to avoid runtime errors.



#### Resolution{% #expected-static-expression-for-function-argument-resolution %}

Replace the dynamic argument with a static expression.

### 403 Invalid argument{% #invalid-argument %}

An invalid argument was passed to the function. The error string will contain more details about what was invalid.

#### Resolution{% #invalid-argument-resolution %}

Check the error string for this error to see what was invalid.

### 601 Invalid timestamp{% #invalid-timestamp %}

The provided timestamp literal is properly formed (i.e. it uses `t'...'` syntax) but the timestamp doesn't adhere to RFC 3339 format.

#### Rationale{% #invalid-timestamp-rationale %}

Invalid timestamps don't compile.

#### Resolution{% #invalid-timestamp-resolution %}

Bring the timestamp in conformance with RFC 3339 format.

#### Examples{% #invalid-timestamp-examples %}

##### Invalid timestamp formatting{% #invalid-timestamp-formatting %}

DPL program:

```bash
.timestamp = format_timestamp!(t'next Tuesday', format: "%v %R")
```

How to fix it:

```diff
-.timestamp = format_timestamp!(t'next Tuesday', format: "%v %R")
+.timestamp = format_timestamp!(t'2021-03-09T16:33:02.405806Z', format: "%v %R")
```

### 620 Aborting infallible function{% #aborting-infallible-function %}

You've specified that a function should abort on error even though the function is infallible.

#### Rationale{% #aborting-infallible-function-rationale %}

In DPL, infallible functions—functions that can't fail—don't require error handling, which in turn means it doesn't make sense to abort on failure using a `!` in the function call.

#### Resolution{% #aborting-infallible-function-resolution %}

Remove the `!` from the function call.

#### Examples{% #aborting-infallible-function-examples %}

##### Aborting infallible function{% #aborting-infallible-function %}

DPL program:

```bash
encode_json!(["one", "two", "three"])
```

How to fix it:

```diff
- 	encode_json!(["one", "two", "three"])
+# 	encode_json(["one", "two", "three"])
```

### 630 Fallible argument{% #fallible-argument %}

You've passed a fallible expression as an argument to a function.

#### Rationale{% #fallible-argument-rationale %}

In DPL, expressions that you pass to functions as arguments need to be infallible themselves. Otherwise, the outcome of the function would be indeterminate.

#### Resolution{% #fallible-argument-resolution %}

Make the expression passed to the function infallible, potentially by aborting on error using `!`, coalescing the error using `??`, or via some other method.

#### Examples{% #fallible-argument-examples %}

##### Fallible argument{% #fallible-argument %}

DPL program:

```bash
format_timestamp!(to_timestamp("2021-01-17T23:27:31.891948Z"), format: "%v %R")
```

How to fix it:

```diff
- 	format_timestamp!(to_timestamp("2021-01-17T23:27:31.891948Z"), format: "%v %R")
+ 	format_timestamp!(to_timestamp!("2021-01-17T23:27:31.891948Z"), format: "%v %R")
```

### 631 Fallible abort message expression{% #fallible-abort-message-expression %}

You've passed a fallible expression as a message to abort.

#### Rationale{% #fallible-abort-message-expression-rationale %}

An expression that you pass to abort needs to be infallible. Otherwise, the abort expression could fail at runtime.

#### Resolution{% #fallible-abort-message-expression-resolution %}

Make the expression infallible, potentially by handling the error, coalescing the error using `??`, or via some other method.

#### Examples{% #fallible-abort-message-expression-examples %}

##### Fallible abort message expression{% #fallible-abort-message-expression %}

DPL program:

```bash
abort to_syslog_level(0)
```

How to fix it:

```diff
- abort to_syslog_level(0)
+ abort to_syslog_level(0) ?? "other"
```

### 640 No-op assignment{% #no-op-assignment %}

You've assigned a value to something that is neither a variable nor a path.

#### Rationale{% #no-op-assignment-rationale %}

All assignments in DPL need to be to either a path or a variable. If you try to assign a value to, for example, underscore (`_`), this operation is considered a "no-op" as it has no effect (and is thus not an assignment at all).

#### Resolution{% #no-op-assignment-resolution %}

Assign the right-hand-side value to either a variable or a path.

#### Examples{% #no-op-assignment-examples %}

##### No-op assignment{% #no-op-assignment %}

DPL program:

```bash
_ = "the hills are alive"
```

How to fix it:

```diff
- 	_ = "the hills are alive"
+# 	.movie_song_quote = "the hills are alive"
```

### 650 Chained comparison operators{% #chained-comparison-operators %}

You've chained multiple comparison operators together in a way that can't result in a valid expression.

#### Rationale{% #chained-comparison-operators-rationale %}

Comparison operators can only operate on two operands, e.g. `1 != 2`. Chaining them together, as in `1 < 2 < 3`, produces a meaningless non-expression.

#### Resolution{% #chained-comparison-operators-resolution %}

Use comparison operators only on a left-hand- and a right-hand-side value. You *can* chain comparisons together provided that the expressions are properly grouped. While `a == b == c`, for example, isn't valid, `a == b && b == c` *is* valid because it involves distinct Boolean expressions.

#### Examples{% #chained-comparison-operators-examples %}

##### Chained comparison operators{% #chained-comparison-operators %}

DPL program:

```bash
1 == 1 == 2
```

How to fix it:

```diff
- 	1 == 1 == 2
+# 	(1 == 1) && (1 == 2)
```

### 651 Unnecessary error coalescing operation{% #unnecessary-error-coalescing-operation %}

You've used a coalescing operation (`??`) to handle an error, but in this case the left-hand operation is infallible, and so the right-hand value after `??` is never reached.

#### Rationale{% #unnecessary-error-coalescing-operation-rationale %}



Error coalescing operations are useful when you want to specify what happens if an operation fails. Here's an example:

```coffee
result = op1 ?? op2
```

In this example, if `op1` is infallible (that is, it can't error) then the `result` variable if set to the value of `op1` while `op2` is never reached.



#### Resolution{% #unnecessary-error-coalescing-operation-resolution %}

If the left-hand operation is meant to be infallible, remove the `??` operator and the right-hand operation. If, however, the left-hand operation is supposed to be fallible, remove the `!` from the function call and anything else that's making it infallible.

### 652 Only objects can be merged{% #only-objects-can-be-merged %}

You're attempting to merge two values together but one or both isn't an object.

#### Rationale{% #only-objects-can-be-merged-rationale %}



Amongst DPL's available types, only objects can be merged together. It's not clear what it would mean to merge, for example, an object with a Boolean. Please note, however, that some other DPL types do have merge-like operations available:

- Strings can be concatenated together
- Arrays can be appended to other arrays

These operations may come in handy if you've used `merge` by accident.



#### Resolution{% #only-objects-can-be-merged-resolution %}

Make sure that both values that you're merging are DPL objects. If you're not sure whether a value is an object, you can use the `object` function to check.

### 660 Non-Boolean negation{% #non-boolean-negation %}

You've used the negation operator to negate a non-Boolean expression.

#### Rationale{% #non-boolean-negation-rationale %}

Only Boolean values can be used with the negation operator (`!`). The expression `!false`, for example, produces `true`, whereas `!"hello"` is a meaningless non-expression.

#### Resolution{% #non-boolean-negation-resolution %}

Use the negation operator only with Boolean expressions.

#### Examples{% #non-boolean-negation-examples %}

##### Non-Boolean negation{% #non-boolean-negation %}

DPL program:

```bash
!47
```

How to fix it:

```diff
- 	!47
+# 	!(47 == 48)
```

### 701 Call to Undefined Variable{% #call-to-undefined-variable %}

The referenced variable is undefined.

#### Rationale{% #call-to-undefined-variable-rationale %}

Referencing a variable that is undefined results in unexpected behavior, and is likely due to a typo.

#### Resolution{% #call-to-undefined-variable-resolution %}

Assign the variable first, or resolve the reference typo.

#### Examples{% #call-to-undefined-variable-examples %}

##### Undefined variable{% #undefined-variable %}

DPL program:

```bash
my_variable
```

How to fix it:

```diff
+my_variable = true
my_variable
```

##### Wrong variable name{% #wrong-variable-name %}

DPL program:

```bash
my_variable = true
my_var
```

How to fix it:

```diff
-my_var
+my_variable
```

### 801 Usage of deprecated item{% #usage-of-deprecated-item %}

The referenced item is deprecated. Usually an alternative is given that can be used instead.

#### Rationale{% #usage-of-deprecated-item-rationale %}

This will be removed in the future.

#### Resolution{% #usage-of-deprecated-item-resolution %}

Apply the suggested alternative.
