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()andvalue().
Static errors (S)
Raised while compiling an expression.
| Code | Message |
|---|---|
S0101 | String literal must be terminated by a matching quote |
S0102 | Number out of range: {{token}} |
S0103 | Unsupported escape sequence: \{{token}} |
S0104 | The escape sequence \u must be followed by 4 hex digits |
S0105 | Quoted property name must be terminated with a backquote ()` |
S0106 | Comment has no closing tag |
S0201 | Syntax error: {{token}} |
S0202 | Expected {{value}}, got {{token}} |
S0203 | Expected {{value}} before end of expression |
S0204 | Unknown operator: {{token}} |
S0205 | Unexpected token: {{token}} |
S0206 | Unknown expression type: {{token}} |
S0207 | Unexpected end of expression |
S0208 | Parameter {{value}} of function definition must be a variable name (start with $) |
S0209 | A predicate cannot follow a grouping expression in a step |
S0210 | Each step can only have one grouping expression |
S0211 | The symbol {{token}} cannot be used as a unary operator |
S0212 | The left side of := must be a variable name (start with $) |
S0213 | The literal value {{value}} cannot be used as a step within a path expression |
S0214 | The right side of {{token}} must be a variable name (start with $) |
S0215 | A context variable binding must precede any predicates on a step |
S0216 | A context variable binding must precede the 'order-by' clause on a step |
S0217 | The object representing the 'parent' cannot be derived from this expression |
S0301 | Empty regular expressions are not allowed |
S0302 | No terminating / in regular expression |
S0402 | Choice groups containing parameterized types are not supported |
S0401 | Type parameters can only be applied to functions and arrays |
S0500 | Attempted to evaluate an expression containing syntax error(s) |
Type errors (T)
Raised while evaluating, when a value has the wrong type.
| Code | Message |
|---|---|
T0410 | Argument {{index}} of function {{token}} does not match function signature |
T0411 | Context value is not a compatible type with argument {{index}} of function {{token}} |
T0412 | Argument {{index}} of function {{token}} must be an array of {{type}} |
T1003 | Key in object structure must evaluate to a string; got: {{value}} |
T1005 | Attempted to invoke a non-function. Did you mean ${{{token}}}? |
T1006 | Attempted to invoke a non-function |
T1007 | Attempted to partially apply a non-function. Did you mean ${{{token}}}? |
T1008 | Attempted to partially apply a non-function |
T1010 | The matcher function argument passed to function {{token}} does not return the correct object structure |
T2001 | The left side of the {{token}} operator must evaluate to a number |
T2002 | The right side of the {{token}} operator must evaluate to a number |
T2003 | The left side of the range operator (..) must evaluate to an integer |
T2004 | The right side of the range operator (..) must evaluate to an integer |
T2006 | The right side of the function application operator ~> must be a function |
T2007 | Type mismatch when comparing values {{value}} and {{value2}} in order-by clause |
T2008 | The expressions within an order-by clause must evaluate to numeric or string values |
T2009 | The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type |
T2010 | The expressions either side of operator {{token}} must evaluate to numeric or string values |
T2011 | The insert/update clause of the transform expression must evaluate to an object: {{value}} |
T2012 | The delete clause of the transform expression must evaluate to a string or array of strings: {{value}} |
T2013 | The 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.
| Code | Message |
|---|---|
D1001 | Number out of range: {{value}} |
D1002 | Cannot negate a non-numeric value: {{value}} |
D1004 | Regular expression matches zero length string |
D1009 | Multiple key definitions evaluate to same key: {{value}} |
D1011 | Stack overflow. Check for non-terminating recursive function. Consider rewriting as tail-recursive |
D1012 | Evaluation timeout after {{value}} milliseconds. Check for infinite loop |
D1013 | Object property names starting with _jsonata_ are reserved for internal use: {{value}} |
D2005 | The left side of := must be a variable name (start with $) |
D2014 | The size of the sequence allocated by the range operator (..) must not exceed 1e7. Attempted to allocate {{value}}. |
D2015 | The maximum sequence length of {{value}} was exceeded. |
D2016 | The size of the string requested by the $pad function must not exceed 1e7. Attempted to allocate {{value}}. |
D3001 | Attempting to invoke string function on Infinity or NaN |
D3010 | Second argument of replace function cannot be an empty string |
D3011 | Fourth argument of replace function must evaluate to a positive number |
D3012 | Attempted to replace a matched string with a non-string value |
D3020 | Third argument of split function must evaluate to a positive number |
D3030 | Unable to cast value to a number: {{value}} |
D3040 | Third argument of match function must evaluate to a positive number |
D3050 | The second argument of reduce function must be a function with at least two arguments |
D3060 | The sqrt function cannot be applied to a negative number: {{value}} |
D3061 | The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}} |
D3070 | The 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 |
D3080 | The picture string must only contain a maximum of two sub-pictures |
D3081 | The sub-picture must not contain more than one instance of the 'decimal-separator' character |
D3082 | The sub-picture must not contain more than one instance of the 'percent' character |
D3083 | The sub-picture must not contain more than one instance of the 'per-mille' character |
D3084 | The sub-picture must not contain both a 'percent' and a 'per-mille' character |
D3085 | The 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' |
D3086 | The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character |
D3087 | The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character |
D3088 | The sub-picture must not contain a 'grouping-separator' at the end of the integer part |
D3089 | The sub-picture must not contain two adjacent instances of the 'grouping-separator' character |
D3090 | The 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' |
D3091 | The 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' |
D3092 | A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator' |
D3093 | The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family' |
D3100 | The radix of the formatBase function must be between 2 and 36. It was given {{value}} |
D3110 | The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}} |
D3120 | Syntax error in expression passed to function eval: {{value}} |
D3121 | Dynamic error evaluating the expression passed to function eval: {{value}} |
D3130 | Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation |
D3131 | In a decimal digit pattern, all digits must be from the same decimal group |
D3132 | Unknown component specifier {{value}} in date/time picture string |
D3133 | The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}} |
D3134 | The timezone integer format specifier cannot have more than four digits |
D3135 | No matching closing bracket ']' in date/time picture string |
D3136 | The date/time picture string is missing specifiers required to parse the timestamp |
D3137 | {{{message}}} |
D3138 | The $single() function expected exactly 1 matching result. Instead it matched more. |
D3139 | The $single() function expected exactly 1 matching result. Instead it matched 0. |
D3140 | Malformed URL passed to ${{{functionName}}}(): {{value}} |
D3141 | {{{message}}} |
D3150 | The 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.
| Code | Message |
|---|---|
U1001 | {{{message}}} |
U1002 | The function ${{{token}}} returned a promise: asynchronous functions are not supported |
U1003 | The evaluation was cancelled |
U1004 | The input could not be read: {{{message}}} |
U1005 | A function passed to ${{{token}}} was called after ${{{token}}} returned |
U2001 | The 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.
| Code | Message |
|---|---|
W0101 | This annotation is not attached to an expression and will be ignored |
W0102 | Unknown annotation tag @{{{tag}}}; expected @label, @message or @id |
W0103 | The value of annotation tag @{{{tag}}} should be a JSON string literal |
W0201 | Field {{token}} is not in the schema{{{hint}}} |
W0202 | Unknown function ${{{token}}}{{{hint}}} |
W0203 | Function ${{{token}}} takes {{{expected}}} but is given {{{count}}} |
W0204 | Variable ${{{token}}} is not declared{{{hint}}} |
W0205 | Argument {{{index}}} of ${{{token}}} is {{{type}}}, which does not match the signature {{{signature}}} |