Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages

Databases and Redis · Troubleshooting walkthrough

Amazon Athena cannot find a column that the query names

Short answer

Athena says Column 'x' cannot be resolved or requester is not authorized when a query names a column it cannot find. Usually a value sits in double quotes and is read as a column name; a CSV byte order mark or a field missing from the Glue schema does too. Check SHOW COLUMNS. Applies to Athena engine 3.

  • Applies to Amazon Athena engine version 3, AWS Glue Data Catalog tables
  • Updated
  • By Maaz Zindani, Senior Software Engineer

This error means Athena looked in the table definition for a column with that exact name and did not find one. The words "or requester is not authorized" are part of the stock message, because Athena gives the same text whether a column is absent or hidden from you. In practice the cause is almost always one of three things in the query or the table, and a single SHOW COLUMNS tells you which.

The most common one is a string value written in double quotes. Athena engine version 3 takes its SQL rules from Trino, where a double-quoted word is a name, never text. Write "active" and Athena goes looking for a column of that name.

The text you see

  • COLUMN_NOT_FOUND: Column 'active' cannot be resolved or requester is not authorized to access requested resources
  • SYNTAX_ERROR: Column cannot be resolved

Stage 1

Compare the name in the error with the real column list

Athena reads columns from the table definition in the Glue Data Catalog, not from the files in S3. List what the catalog holds and set it beside the name in the error, one letter at a time.

The columns Athena knows about

SHOW COLUMNS IN analytics.orders
What you seeLikely causeSection
The name in the error is a value you meant to compare withDouble quotes around a stringQuotes
The first column starts with a question markA byte order mark from a CSVBOM
The name is not in the list at all, but the files have itThe table schema is older than the dataSchema

Stage 2

Quotes around a value

A query such as WHERE status = "active" asks Athena to compare status with a column called active. No such column exists, so it stops with Column 'active' cannot be resolved. This is a habit carried over from databases and tools that accept double quotes for text, and it fails the same way in every Athena query, including ones inside views.

Value in single quotes, awkward name in double quotes

-- fails: "active" is treated as a column name
SELECT * FROM analytics.orders WHERE status = "active" LIMIT 10
-- works: single quotes for values, double quotes only for identifiers
SELECT order_id, "end" FROM analytics.orders WHERE status = 'active' LIMIT 10

Double quotes are still correct for a column that needs escaping, such as one named after a reserved word like end.

Stage 3

A question mark in the first column name

Athena's troubleshooting guide describes a case where a Glue crawler reads a UTF-8 CSV that begins with a byte order mark. The crawler does not recognise the BOM and stores it in the first column's name as a question mark, so a query for id cannot match ?id, while every other column works.

Edit the column name in the Glue table definition, or recreate the table with the clean name. The files themselves are the source: if they keep their BOM, the next crawler run can add the mark again, so save exports as UTF-8 without a BOM.

Query with the clean name

-- after renaming the column in the Glue console
SELECT id FROM analytics.orders LIMIT 10

Stage 4

A field the table does not have yet

When a producer adds a field to new files, nothing changes in the catalog until someone updates it. Queries that name the new field fail while old ones keep working, which is why this tends to appear right after a release on the producer side.

Either rerun the crawler that owns the table or add the column by hand. ALTER TABLE ADD COLUMNS places new columns after the existing ones and before partition columns, and it does not accept the date type, so use timestamp for dates.

Add the field with the type the files use

ALTER TABLE analytics.orders ADD COLUMNS (coupon_code string)

Files written before the field existed return NULL for it. That is expected, not a second error.

Stage 5

Confirm it, and when the name is listed but the query still fails

After a fix, the column list should show the name exactly, and a query on it should return rows. Test with a count that filters on the column, so you see real values and not just an empty result.

Check the list, then the query

SHOW COLUMNS IN analytics.orders
SELECT count(*) FROM analytics.orders WHERE status = 'active'
  • Name listed exactly and the error stays: check Lake Formation. It can limit which columns a role may see, and only an administrator can grant them.
  • Name listed, query fine in the console but failing from an application: compare the role the application uses with your own.

If you only keep one thing

  • Single quotes for values, double quotes only for identifiers.
  • A leading question mark in the first column name means a BOM; fix the name and export without it.
  • The catalog decides what Athena can see, so add new fields to the table when the files gain them.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Next step

Want a second pair of eyes on it?

Send me the error and what changed before it started. I reply within 24 hours.