Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Error reference

Every error jlens reports carries a stable code. The codes and messages match those of jsonata-js, so code that handles JSONata errors works unchanged. In a message template, {{name}} is replaced with the JSON form of the error detail name, and {{{name}}} with its raw text.

Errors expose:

  • code();
  • message();
  • position(), a UTF-16 offset just past the offending token, as in jsonata-js;
  • span(), the byte range of the offending text;
  • details such as token() and value().

Static errors (S)

Raised while compiling an expression.

CodeMessage
S0101String literal must be terminated by a matching quote
S0102Number out of range: {{token}}
S0103Unsupported escape sequence: \{{token}}
S0104The escape sequence \u must be followed by 4 hex digits
S0105Quoted property name must be terminated with a backquote ()`
S0106Comment has no closing tag
S0201Syntax error: {{token}}
S0202Expected {{value}}, got {{token}}
S0203Expected {{value}} before end of expression
S0204Unknown operator: {{token}}
S0205Unexpected token: {{token}}
S0206Unknown expression type: {{token}}
S0207Unexpected end of expression
S0208Parameter {{value}} of function definition must be a variable name (start with $)
S0209A predicate cannot follow a grouping expression in a step
S0210Each step can only have one grouping expression
S0211The symbol {{token}} cannot be used as a unary operator
S0212The left side of := must be a variable name (start with $)
S0213The literal value {{value}} cannot be used as a step within a path expression
S0214The right side of {{token}} must be a variable name (start with $)
S0215A context variable binding must precede any predicates on a step
S0216A context variable binding must precede the 'order-by' clause on a step
S0217The object representing the 'parent' cannot be derived from this expression
S0301Empty regular expressions are not allowed
S0302No terminating / in regular expression
S0402Choice groups containing parameterized types are not supported
S0401Type parameters can only be applied to functions and arrays
S0500Attempted to evaluate an expression containing syntax error(s)

Type errors (T)

Raised while evaluating, when a value has the wrong type.

CodeMessage
T0410Argument {{index}} of function {{token}} does not match function signature
T0411Context value is not a compatible type with argument {{index}} of function {{token}}
T0412Argument {{index}} of function {{token}} must be an array of {{type}}
T1003Key in object structure must evaluate to a string; got: {{value}}
T1005Attempted to invoke a non-function. Did you mean ${{{token}}}?
T1006Attempted to invoke a non-function
T1007Attempted to partially apply a non-function. Did you mean ${{{token}}}?
T1008Attempted to partially apply a non-function
T1010The matcher function argument passed to function {{token}} does not return the correct object structure
T2001The left side of the {{token}} operator must evaluate to a number
T2002The right side of the {{token}} operator must evaluate to a number
T2003The left side of the range operator (..) must evaluate to an integer
T2004The right side of the range operator (..) must evaluate to an integer
T2006The right side of the function application operator ~> must be a function
T2007Type mismatch when comparing values {{value}} and {{value2}} in order-by clause
T2008The expressions within an order-by clause must evaluate to numeric or string values
T2009The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type
T2010The expressions either side of operator {{token}} must evaluate to numeric or string values
T2011The insert/update clause of the transform expression must evaluate to an object: {{value}}
T2012The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}
T2013The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.

Dynamic errors (D)

Raised while evaluating, for other run-time problems.

CodeMessage
D1001Number out of range: {{value}}
D1002Cannot negate a non-numeric value: {{value}}
D1004Regular expression matches zero length string
D1009Multiple key definitions evaluate to same key: {{value}}
D1011Stack overflow. Check for non-terminating recursive function. Consider rewriting as tail-recursive
D1012Evaluation timeout after {{value}} milliseconds. Check for infinite loop
D1013Object property names starting with _jsonata_ are reserved for internal use: {{value}}
D2005The left side of := must be a variable name (start with $)
D2014The size of the sequence allocated by the range operator (..) must not exceed 1e7. Attempted to allocate {{value}}.
D2015The maximum sequence length of {{value}} was exceeded.
D2016The size of the string requested by the $pad function must not exceed 1e7. Attempted to allocate {{value}}.
D3001Attempting to invoke string function on Infinity or NaN
D3010Second argument of replace function cannot be an empty string
D3011Fourth argument of replace function must evaluate to a positive number
D3012Attempted to replace a matched string with a non-string value
D3020Third argument of split function must evaluate to a positive number
D3030Unable to cast value to a number: {{value}}
D3040Third argument of match function must evaluate to a positive number
D3050The second argument of reduce function must be a function with at least two arguments
D3060The sqrt function cannot be applied to a negative number: {{value}}
D3061The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}
D3070The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function
D3080The picture string must only contain a maximum of two sub-pictures
D3081The sub-picture must not contain more than one instance of the 'decimal-separator' character
D3082The sub-picture must not contain more than one instance of the 'percent' character
D3083The sub-picture must not contain more than one instance of the 'per-mille' character
D3084The sub-picture must not contain both a 'percent' and a 'per-mille' character
D3085The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'
D3086The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character
D3087The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character
D3088The sub-picture must not contain a 'grouping-separator' at the end of the integer part
D3089The sub-picture must not contain two adjacent instances of the 'grouping-separator' character
D3090The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'
D3091The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'
D3092A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'
D3093The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'
D3100The radix of the formatBase function must be between 2 and 36. It was given {{value}}
D3110The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}
D3120Syntax error in expression passed to function eval: {{value}}
D3121Dynamic error evaluating the expression passed to function eval: {{value}}
D3130Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation
D3131In a decimal digit pattern, all digits must be from the same decimal group
D3132Unknown component specifier {{value}} in date/time picture string
D3133The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}
D3134The timezone integer format specifier cannot have more than four digits
D3135No matching closing bracket ']' in date/time picture string
D3136The date/time picture string is missing specifiers required to parse the timestamp
D3137{{{message}}}
D3138The $single() function expected exactly 1 matching result. Instead it matched more.
D3139The $single() function expected exactly 1 matching result. Instead it matched 0.
D3140Malformed URL passed to ${{{functionName}}}(): {{value}}
D3141{{{message}}}
D3150The timezone must be a number of hours and minutes, such as +0530: {{value}}

Guardrail errors (U)

Raised when an evaluation exceeds its configured limits, is cancelled, or needs what jlens does not support. U2001 is raised by jlens eval --json for an input document that is not valid JSON.

CodeMessage
U1001{{{message}}}
U1002The function ${{{token}}} returned a promise: asynchronous functions are not supported
U1003The evaluation was cancelled
U1004The input could not be read: {{{message}}}
U1005A function passed to ${{{token}}} was called after ${{{token}}} returned
U2001The input is not valid JSON: {{{message}}}

Warnings (W)

jlens-specific. Warnings are reported as diagnostics by jlens check and parse_recover, and never stop evaluation.

CodeMessage
W0101This annotation is not attached to an expression and will be ignored
W0102Unknown annotation tag @{{{tag}}}; expected @label, @message or @id
W0103The value of annotation tag @{{{tag}}} should be a JSON string literal
W0201Field {{token}} is not in the schema{{{hint}}}
W0202Unknown function ${{{token}}}{{{hint}}}
W0203Function ${{{token}}} takes {{{expected}}} but is given {{{count}}}
W0204Variable ${{{token}}} is not declared{{{hint}}}
W0205Argument {{{index}}} of ${{{token}}} is {{{type}}}, which does not match the signature {{{signature}}}