{"record":{"id":"d171325d8e6212ca","repo":"prestodb/presto","slug":"missing-attribute","errorCode":"MISSING_ATTRIBUTE","errorMessage":"Column '%s' cannot be resolved","messagePattern":"Column '(.+?)' cannot be resolved","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-analyzer/src/main/java/com/facebook/presto/sql/analyzer/SemanticExceptions.java","lineNumber":32,"sourceCode":"package com.facebook.presto.sql.analyzer;\n\nimport com.facebook.presto.sql.tree.Expression;\nimport com.facebook.presto.sql.tree.Node;\nimport com.facebook.presto.sql.tree.NodeLocation;\nimport com.facebook.presto.sql.tree.QualifiedName;\n\nimport static com.facebook.presto.sql.analyzer.SemanticErrorCode.AMBIGUOUS_ATTRIBUTE;\nimport static com.facebook.presto.sql.analyzer.SemanticErrorCode.MISSING_ATTRIBUTE;\nimport static com.facebook.presto.sql.analyzer.SemanticErrorCode.NOT_SUPPORTED;\nimport static java.lang.String.format;\n\npublic final class SemanticExceptions\n{\n    private SemanticExceptions() {}\n\n    public static SemanticException missingAttributeException(Expression node, QualifiedName name)\n    {\n        throw new SemanticException(\n                MISSING_ATTRIBUTE,\n                node,\n                name.getPrefix().isPresent() ? \"'%s' cannot be resolved\" : \"Column '%s' cannot be resolved\",\n                name);\n    }\n\n    public static SemanticException ambiguousAttributeException(Expression node, QualifiedName name)\n    {\n        throw new SemanticException(AMBIGUOUS_ATTRIBUTE, node, \"Column '%s' is ambiguous\", name);\n    }\n\n    public static SemanticException notSupportedException(Node node, String notSupportedFeatureDescription)\n    {\n        throw new SemanticException(NOT_SUPPORTED, node, notSupportedFeatureDescription + \" is not supported\");\n    }\n\n    public static String subQueryNotSupportedError(Node node, String notSupportedFeatureDescription)\n    {","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-analyzer/src/main/java/com/facebook/presto/sql/analyzer/SemanticExceptions.java#L14-L50","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"-- before\nSELECT user_name FROM users          -- column is actually named username\n-- after\nSELECT username FROM users","handlingStrategy":"validation","validationCode":"-- Resolve the column before running the query\nSELECT column_name FROM information_schema.columns WHERE table_schema='s' AND table_name='t' AND column_name='mycol';","typeGuard":null,"tryCatchPattern":"try { /* run query */ } catch (SemanticException e) { if (\"MISSING_ATTRIBUTE\".equals(e.getErrorCode().getName())) { /* DESCRIBE table and fix column name */ } throw e; }","preventionTips":["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"],"tags":["sql","column-resolution","semantic-error"],"backgroundTag":"column-cannot-be-resolved","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}