View a markdown version of this page

Athena error catalog - Amazon Athena

Athena error catalog

Athena provides standard error information to help you understand failed queries and decide what to do next. When a query on DuckDB fails, the Status.AthenaError object in the GetQueryExecution response has an ErrorCategory field and an ErrorType field. ErrorCategory is an integer. It tells you whether the cause is a system error (1) or a user error (2). ErrorType is an integer that gives you more detail about the cause. Use the two fields together to find what caused the error and what to do next.

The Status.AthenaError object also has ErrorMessage, a description of the error. It also has Retryable, a Boolean that tells you whether the query might succeed if you run it again.

DuckDB uses the same integer values as Athena engine version 3. For information about the values for engine version 3, see Athena engine version 3 error catalog.

Error messages use the wording from DuckDB. This wording differs from engine version 3. If your app handles failed queries, base its logic on ErrorCategory and ErrorType, not on the message text.

Error category

The following table lists the ErrorCategory values, their meanings, and what to do for each.

ErrorCategory Cause What to do
1 System error in Athena Run the query again. If the error continues, contact AWS Support with the query ID.
2 User error in the query, data, table, or permissions Use ErrorMessage to find the cause. Fix it, and then run the query again.

Error message

For most errors with ErrorCategory 2, ErrorMessage describes the cause. For example, it names the table that doesn't exist or the value that couldn't be converted.

For errors with ErrorCategory 1, and for some errors with ErrorCategory 2, ErrorMessage is a general message. It asks you to run the query again. It also asks you to contact AWS Support with the query ID if the error continues. In this case, use ErrorType to find the cause.

Error type reference

The following table lists the ErrorType values that DuckDB returns, with the ErrorCategory value that each one comes with. For information about error types that this table doesn't list, see Athena engine version 3 error catalog.

ErrorType ErrorCategory Description What to do
1 1 Athena ran out of memory while it ran the query. Run the query again. To make the error less likely, reduce the memory that the query uses. For more information, see Reduce memory use. If the error continues, contact AWS Support with the query ID.
6 2 The query exceeded a resource limit while it sorted, joined, or grouped data. Run the query again. If the error continues, reduce the data that the query processes. For more information, see Reduce memory use. If the error still continues, contact AWS Support with the query ID.
218 1 The query engine had an internal error. Run the query again. If the error continues, contact AWS Support with the query ID.
400 1 Athena got an error from a dependent service such as Amazon Simple Storage Service (Amazon S3), or an error while it wrote the query results. Run the query again later. If the error continues, contact AWS Support with the query ID.
1000 2 The query isn't valid for the tables, columns, or values that it references. Use ErrorMessage to find the cause, and then fix the query.
1001 2 An arithmetic error occurred, such as a value out of range for its type or a division by zero. Use a larger data type, or use TRY_CAST or a CASE expression to handle the value.
1002 2 A value can't be converted to the target type, or a value doesn't meet a constraint of the column, such as NOT NULL. For a value that can't be converted, use TRY_CAST to return NULL, or filter out the value with a WHERE clause. For a value that doesn't meet a constraint, change the value, or filter out the row before you write it.
1005 2 Athena couldn't read or write a value in its expected format, such as a JSON string or geometry metadata that isn't valid. Use ErrorMessage to find the value, and then check that it is valid for its format.
1006 2 The query has a syntax error. Fix the syntax. For the SQL that DuckDB accepts, see SQL reference.
1007 2 The statement failed in its transaction. Before you run a write statement again, check whether it was applied. For more information, see Check before you retry a write.
1014 2 The query was canceled. If you didn't cancel the query, run it again.
1100 2 The query has an invalid argument, setting, or parameter value. For example, a malformed Amazon S3 location. Use ErrorMessage to find the value, and then fix it.
1109 2 A statement that writes files targets an Amazon S3 location that already contains files. Write to an empty location, or remove the files from the location in ErrorMessage.
1110 2 An object with that name already exists. Use a different name, or add IF NOT EXISTS to the statement.
1200 2 The statement, feature, or table isn't supported on DuckDB. For information about supported statements and features, and their alternatives, see SQL reference.
1202 2 The table isn't supported, for example a table that has no Amazon S3 location. Query a table that has an Amazon S3 location in a supported format.
1301 2 A table, database, column, or function that the query references doesn't exist. Check the name and the catalog, database, and table that ErrorMessage names.
1302 2 No file exists at a path that the query reads. For example, a file path in the query, or a table location that has no files. Check the file path in the query or the Amazon S3 location of the table.
1303 2 No function matches the name and argument types in the query. Check the function name, or cast the arguments to the types that the function accepts.
1306 2 Amazon S3 reported that a bucket or object that the query uses doesn't exist. Check that the bucket and object exist and are in the Region that you expect.
1401 1 AWS Glue throttled requests that the query made. Run the query again later. If the error continues, contact AWS Support with the query ID.
1403 1 or 2 Amazon S3 throttled the query's requests, or AWS Key Management Service (AWS KMS) throttled requests that Amazon S3 made for the query. ErrorCategory is 2 when the requests read or write the query's data. Run the query again later. To reduce Amazon S3 throttling, use fewer, larger files or more Amazon S3 prefixes. To reduce AWS KMS throttling, request an AWS KMS quota increase or turn on Amazon S3 Bucket Keys. If the error continues, contact AWS Support with the query ID.
1500 2 The principal that ran the query can't access a resource. For example, an Amazon S3 location, an AWS Glue resource, an AWS Lake Formation resource, or an AWS KMS key. Athena doesn't permit some statements and functions, such as SET, USE, CREATE MACRO, and current_setting. If the query uses one of them, Athena also returns this error type. In that case, ErrorMessage is This operation isn't permitted. Check the permissions of the principal. For more information, see Security and permissions. If ErrorMessage is This operation isn't permitted., remove the statement or function from the query. Changing permissions doesn't help. For the statements and functions that you can't use, see Open-source DuckDB functions and features not available in Athena.