prestodb/presto · error · SemanticException
MISSING_ATTRIBUTE
MISSING_ATTRIBUTE
Error message
Column '%s' cannot be resolved
What it means
SemanticExceptions.missingAttributeException builds the standard 'cannot be resolved' SemanticException (code MISSING_ATTRIBUTE) when name resolution fails for a column/attribute during analysis. The message drops the 'Column' prefix when the name is qualified.
Source
Thrown at presto-analyzer/src/main/java/com/facebook/presto/sql/analyzer/SemanticExceptions.java:32
package com.facebook.presto.sql.analyzer;
import com.facebook.presto.sql.tree.Expression;
import com.facebook.presto.sql.tree.Node;
import com.facebook.presto.sql.tree.NodeLocation;
import com.facebook.presto.sql.tree.QualifiedName;
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.AMBIGUOUS_ATTRIBUTE;
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.MISSING_ATTRIBUTE;
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.NOT_SUPPORTED;
import static java.lang.String.format;
public final class SemanticExceptions
{
private SemanticExceptions() {}
public static SemanticException missingAttributeException(Expression node, QualifiedName name)
{
throw new SemanticException(
MISSING_ATTRIBUTE,
node,
name.getPrefix().isPresent() ? "'%s' cannot be resolved" : "Column '%s' cannot be resolved",
name);
}
public static SemanticException ambiguousAttributeException(Expression node, QualifiedName name)
{
throw new SemanticException(AMBIGUOUS_ATTRIBUTE, node, "Column '%s' is ambiguous", name);
}
public static SemanticException notSupportedException(Node node, String notSupportedFeatureDescription)
{
throw new SemanticException(NOT_SUPPORTED, node, notSupportedFeatureDescription + " is not supported");
}
public static String subQueryNotSupportedError(Node node, String notSupportedFeatureDescription)
{View on GitHub (pinned to 55bb57d202)
Solutions
- Check spelling and case of the column name (DESCRIBE table)
- Confirm the table/alias containing the column is in the FROM/JOIN clause
- If referencing an alias defined in SELECT, restructure (subquery/CTE) so it is visible in the clause used
Example fix
-- before SELECT user_name FROM users -- column is actually named username -- after SELECT username FROM users
Defensive patterns
Strategy: validation
Validate before calling
-- Resolve the column before running the query SELECT column_name FROM information_schema.columns WHERE table_schema='s' AND table_name='t' AND column_name='mycol';
Try / catch
try { /* run query */ } catch (SemanticException e) { if ("MISSING_ATTRIBUTE".equals(e.getErrorCode().getName())) { /* DESCRIBE table and fix column name */ } throw e; } Prevention
- Run DESCRIBE table to confirm column names and spelling
- Always qualify columns with table aliases in multi-table queries
- Update queries after column renames; search for stale names
When it happens
Trigger: Referencing a column that does not exist in the queried relation; a typo in a column name; referencing a column from a table not in the FROM clause; wrong qualifier (alias.schema.table.column) that cannot be resolved.
Common situations: Typos after renaming columns; forgetting a table alias prefix; using a column alias in WHERE/GROUP BY where it is not visible; querying a view whose underlying column changed.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/d171325d8e6212ca.
Report an issue: GitHub.