AQL - Error codes

When AQL processes a query, a number of checks are performed at various stages of the processing. Every type of error that can occur during query processing has been assigned a number code that can be looked up in the table below.

The errors have been arranged into various categories and color-coded according to the key at the bottom of this page.

An asterisk (*) in a quoted error message stands for some value filled in according to the actual query use.

Number Code Error message Explanation and Examples

700 Syntax error The query doesn't satisfy the syntax as defined by the parsing grammar. Other syntax errors that slip through the net of first-pass parsing will be reported using more specific error codes.

701 Syntax error : invalid character The query contains a character that isn't defined anywhere in the parsing grammar.

702 Syntax error : Bad time/data literal The string following the ` isn't a valid date, see date syntax for details..

703 Syntax error: unrecognized Method name '*' caused by a query like
select a, a.function from a in class C1
The Method function is not a recognized method. See the language documentation for a list of valid Method names.

990 scalar variable * undefined caused by a query like
select a from a in class C1 where a->Field1 == $x
The scalar variable $x has to be defined in the previous query or in the environment context.

991 table variable * undefined caused by a query like
select a:1 from a in @t
The table-variable @t has to be defined in the previous query or in the environment context.

992 iterator variable * undeclared caused by a query like
select a, b from a in class author
The locator-variable b has to be declared in the from-clause of the same query.

993 no unnamed iterator declaration caused by a query like
select p from p in class person where exists ->born
The argument for the exists expression uses the default iterator, which is used for unnamed declarations. Use either
select p from p in class person where exists p->born
or
select all class person where exists ->born

961 Malformed FROM in SelectFromWhere caused by a query like
select s from sequence

988 only one declaration allowed for default iterator caused by a query like
select all from a,b
The default locator that is initiated by select all can only be based upon one declaration. It cannot be redeclared in the same table expression.

989 multiple declaration of variable * in same scope caused by a query like
select a from a in class C1, a in class C2
The from-clause defines the variable a to be derived from class C1, but then you can't define the same variable based on a different class again.

958 invalid declaration caused by a query like
$x:= @t:2
where a table-variable is referenced without a proper declaration.
This query makes no sense because $x is a scalar variable (i.e. can only have one value) and @t:2 is a column of a table (i.e. a list of values).

959 invalid outside declaration caused by a query like
$x := yeardiff(p->Title, now)
where p->Title refers to a declaration outside the function that doesn't exist.

930 Invalid column-selection on *:* caused by a query like
select a:<columnNo> from a in class movie
The select-field is a row-variable a, but it is illogical to extract a column (specified by number) from a class-based from-clause
 --or--
select a:<columnNo> from a in @tb:1
The variable a is already declared to iterate over columns in @tb, so another column selection in a single-value iterator makes no sense.

931 Invalid column-selection on *:* This error is a slight variation on error 930, but for invalid column selection by name. (Error 930 deals with selection by column-number).

932 variable * is row based and must specify the column that is to be extracted from the iterating rows caused by a query like
select a from a in @tb
The from-clause defines the variable a as a row-variable on the table-variable tb. The select-clause states that a should be output to the results-table, but a is an entire column. We need to refer to the exact column in the row a in order to extract just a single value for the results-table.
The query select a:1 from a in @tb is OK, and it will pull out the first (i.e. leftmost) column from the table.
However, the parser could allow the original query above, in the case that @tb has only one column anyway. This is currently not implemented.

933 Cannot dereference a row-based variable directly caused by a query like
select a->tagname from a in @tb
This error is a slight variation on error 932. We cannot dereference a, as it stands for an entire row from table @tb. The query select a:1->tagname from a in @tb would be correct in the case that the object values in column 1 in table @tb should be followed up to tag tagname.

920 table <union/diff/intersect> operator - column number mismatch caused by a query like
select a->Field1, a->Field2 from a in class C1
union
select b->Field1 from b in class C2
The table operators union, diff (aka except) and intersect can only combine two table that have the same number of columns, whereas the above example yields a two-column table with the query on class C1 and a one-column table with the query on class C2.

921 table-argument for tableFunc expression must generate ONLY 1 column caused by a query like
$x := count(select a->Field1, a->Field2 from a in class C1)
The table-functions (count, sum, avg, min, max, first, last) can only act on tables that have one column. The inner select-query should be restricted to one select field or the column specified by name or number.
$x := count(select a->Field1 from a in class C1)
$x := count(select a->Field1, a->Field2 from a in class C1):1

922 field number * out of range caused by a query like
select a, b from a in ..., b in ... order by :3
The table returns two result column, but the sort-clause is trying to refer to a third column in the result table on which to sort by. The number of that field in invalid for the given select-clause.
This error may be reported for table-fields with the order keyword, fields in row-variables and when a table-function specifies a field-number as in
$x := max(select a, b from ... ):4

923 field name * not in table caused by a query like
select a from a in ... order by :b
Similar to error 922, but traps named references to non-existing table-fields.
The sort field 'b' isn't recognised in the result table, because the select-clause only defines the result to have a table with one column called 'a'.
This error may be reported for table-field names used with the order keyword, field-names in row-variables and when a table-function specifies a non-existing field-name as in
$x := max(select a from ... ):b

883 The like operator can only be used on Text types The operator ~ or the keyword like can only be used to compare Text values. One of the expressions either side of the operator does not evaluate to a Text value-type.
NOTE: when Object-values are compared to Text, so ~ can be used.

884 illegal value types for comparison operator The comparison operator used is not supported (or makes no sense) for the value types involved in the expression


885

Comparison involving boolean values only allows = and != operators


886

Comparison of two Object values only allows = and != operators

887 Only min() or max() function can operate over DateType values! caused by a query like
$y := avg (select p->Publish_Date from a in class Author, p in a->Paper)
The inner query produces a list of dates on which authors have published their papers.
The table-function avg is not defined for values of type DateType, only min and max can be used on DateType tables.

888 Only min() or max() function can operate over Text values! caused by a query like
$y := avg (select a->Full_name from a in class Author)
The inner query produces a list of names of all authors.
The table-function avg is not defined for values of type Text, only min and max can be used on Text tables.

889 Table selection returns wrong type of value. caused by a query like
$x := sum (select a->Name from a in class Author)
The inner query lists the names of all authors. These names would naturally be string values.
Functions min, max only work over columns of Int, Float or DateType values. The functions sum, avg work over numeric values (Int or Float) only.

890 operand of <dateDiffFunc>() is not a DateType caused by a query like
select a, Age::yeardiff(a->Name, now) from a in class Author
This is the wrong query, if the user wanted the authors age to be calculated as the difference in years between the current date and the date of his/her birth.
The field a->Name will probably return a string value, and therefore the yeardiff function will fail.

895 Arithmetic exception - division by zero caused by a division of integer or float value zero. (Any other value-type in a division by zero will cause error No 896 first.)

896 invalid expression types (*).(*) for arithmetic operator caused by a query like
select a, (a->Born + 10.0) from a in class Author
when the second select-field expression is evaluated, a->Born assumes DateType values, whereas 10.0 is a Float.

The arithmetic operators +, -, *, / are only defined for numeric data-types (Int, Float).


897 invalid expression types (*).(*) for modulo operator (integer only) The modulo operator only works on integer values. If either of the expressions evaluate to ny other type, you will get this error.

898 incorrect expression type (*) for unary MINUS operator caused by a query like
select a from a in class Author where -a = "ddd"
The variable a will assume Object values during evaluation. In an arithmetic expression the minus operator '-' can only be used for Int and Float values, but naturally not for DateType, Text, Object-values or others.

899 incorrect expression type (*) for abs() ExprFunc caused by a query like
select a, abs(a->Paper) from a in class Author
The locator a->Paper will assume Object values during evaluation. The expression function abs() can only be used for Int and Float values, but naturally not for DateType, Text, Object-values or others.

860 invalid valuetype of operand for method 'name' The method 'name' can only be used on object or tag-values. It converts the internal key of the object or tag into a Text-string.
The use of this method on a variable of any other valuetype will raise this error.
Note: In table-results that are rendered into text-format usually show object and text-values in the same way - as quoted strings.

861 invalid valuetype of operand for method 'class' The method 'class' can only be used on object-values. It will return the Text-string for the class-name of an object value.
The use of this method on a variable of any other valuetype will raise this error.

862 invalid valuetype of operand for method 'length' The 'length' method return an integer containing the length of an array or Text-string. The operand to this method must be either a Text-value or an object value. Error 863 will be raised if an object value does not belong to an A-class, which stores arrays (as opposed to B-classes which store objects in B-tree format).
The use of this method on an iterator of any other valuetype will cause this error.

863 invalid valuetype of operand for method 'length' This error is raised if the operand to the 'length' method is an object not belonging to an A-class.
See Error 862.

864
invalid valuetype of operand for method 'create_time'
'create_session'
'update_time'
'update_session'
These timestamps methods can only be used on object-values.
They return either a DateType-value or an object-value of a UserSession object relating to the session when that object was created or updated.
The use of this method on a variable of any other valuetype will raise this error.

865
invalid valuetype of operand for method 'node_time'
'node_session'
These timestamps methods operate on a piece of data inside an object. That means the variable that this method can be called on, must refer to a tag or a data-value positioned relative to a tag in an object. Therefor this method only works if called upon such values.
The methods return either a DateType-value or an object-value of a UserSession object relating to the session when that tag or data-node was added to the object.
The use of this method on a variable of any other valuetype will raise this error.

850 Multiple declaration of table variable * in environment scope A table variable has been declared twice in the environment context of the query. This is possibly an error in the application program that uses AQL.

810 Incinsistent value types in table column * caused by a query like
select x[1],x[2],x[3],x[4] from x in object("Class","Key")
Depending on the model for objects of class Class, the object tree might use different value-types for the data at deeper levels. So, the result-table gets initialized with whatever type it finds first, and at a different branch in the tree that maps to the same table column it may find tags of a different value type that can't be placed in the same result-table column that has been created with a different type before.

941 Unrecognized class * caused by a query like
select a->Field1 from a in class Class1
where Class1 is not a valid class in the database.

942 Unrecognized class * in construct object("<class>", ...) caused by a query like
select all object ("Sequqnce", "KH462")
where Sequqnce is not a valid class in the database.

952 invalid value-type of left expression in object constructor caused by a query like
select a, object(3.14, "Address") from a in class Author
Where the right expression 3.14 does not represent a key value of a class. Only direct key values (i.e. class(a) in the above query) or string literals yield key values in the object constructor.

943 Can't find *:* - object "*" not found in class "*" caused by a query like
select a->address from a in object ("Author", "martin")
where the key martin does not exist in class Author.

953 invalid value-type of right expression in object constructor caused by a query like
select a, object("paper", 3.14) from a in class Author
Where the right expression 3.14 does not represent a key value. Only direct key values (i.e. a in the above query) or string literals yield key values in the object constructor.

944 Unrecognized tag * caused by queries like
select a->Field1 from a in class Class1
select all object("Class1", "Key")->Field1
where the tag Field1 does not exist in class Class1.

900 Follow position : Trying to dereference (->) something not an object

901 Follow tag : Trying to dereference (->) something not an object caused by a query like
select a, b->Full_name from a in class author, b in a->Full_name
Only locators that return Key-type values can be dereferenced using the ARROW operator ->. In this case b is declared to be a->Full_name (let's say that's a string value), but the select field tries to extract a tag from it (Full_name again), so this query is most probably a typo.

902 Positioning within an object has to follow a tag caused by a queries like
select a[1] from a in class Movie
select ->0, [cast] from class movie
The notation that allows an iterator to position to a tag or position within the references object has to be base upon a tag and can't be rooted directly at the object itself.
The notation [tagname] only makes sense if used as obj->tag[positioning], where positioning is the number of steps to the right or a name to jump to directly.

Note: It is always possible to write

a->Mail
instead of
a->Address[Mail]

903 Illegal argument to boolean clause `exists_tag' (tags-by-name only) caused by a query like
... where exists_tag ->email[1]
The variable b is declared to move one to the right in the object model of a which is from class Author.

That is very ambiguous and only allowed by dereferencing an object using the follow-tag notation.


960 table combining operator - error in column *, value-type mismatch between the columns the two tables caused by a query like (find all American authors that haven't yet published)
(select a->Full_name from a in class Author where a->address = "USA")
except
(select all class Author where exists ->Paper)
According to database specific evaluation, the first query produces a table that is a list of strings, whereas the second one returns a list of key-values.

The table operator can only combine row-compatible tables, i.e. the value types have to match in each column of both tables.


962 table combining operator - value-type mismatch between the columns the two tables As error 962 - Sometimes the value-types of table columns aren't known until both tables are fully computed. This might be the case, if a select-field is calculated as an expression whose final value isn't known until the database specific expression evaluation.
Therefor a possible type mismatch (Error 960) remains unnoticed until after complete construction of both tables. This error will pick out any mismatches that occur during table evaluation.

The causes of these errors will be fixed in the future


798 Sorry : Unimplemented date-function weekdiff() The weekdiff() date-function hasn't been written yet (as of 991004)

Color codes of error categories


Syntax Error see AQL Syntax Document
Semantic Error Although the query passes the syntax check, the query isn't allowed by the language specifications
Logical Error Basically a semantic error as well, but probably just the wrong query.
Evaluation Error The query fails, because the specific database that is being used
Unimplemented feature Query is not wrong, but uses a certain language feature, that is not yet implemented

acedb@sanger.ac.uk