{"record":{"id":"305578aab41c6712","repo":"risingwavelabs/risingwave","slug":"invalid-reference-0","errorCode":null,"errorMessage":"Invalid reference: {0}","messagePattern":"Invalid reference: (.+?)","errorType":"error_code","errorClass":"ErrorCode","httpStatus":null,"severity":"error","filePath":"src/frontend/src/error.rs","lineNumber":153,"sourceCode":"    CatalogError(\n        #[source]\n        #[backtrace]\n        #[message]\n        BoxedError,\n    ),\n    #[error(\"Protocol error: {0}\")]\n    ProtocolError(#[message] String),\n    #[error(\"Scheduler error: {0}\")]\n    SchedulerError(\n        #[source]\n        #[backtrace]\n        BoxedError,\n    ),\n    #[error(\"Task not found\")]\n    TaskNotFound,\n    #[error(\"Session not found\")]\n    SessionNotFound,\n    #[error(\"Invalid reference: {0}\")]\n    InvalidReference(String),\n    #[error(\"Item not found: {0}\")]\n    ItemNotFound(String),\n    #[error(\"Duplicate Relation Name: {0}\")]\n    DuplicateRelationName(String),\n    #[error(\"Invalid insert operation: {0}\")]\n    InsertViolation(String),\n    #[error(\"Invalid input syntax: {0}\")]\n    InvalidInputSyntax(#[message] String),\n    #[error(\"Cannot compare in memory: {0}\")]\n    MemComparableError(#[from] memcomparable::Error),\n    #[error(\"Error while de/se values: {0}\")]\n    ValueEncodingError(\n        #[from]\n        #[backtrace]\n        ValueEncodingError,\n    ),\n    #[error(\"Invalid value `{config_value}` for `{config_entry}`\")]","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/frontend/src/error.rs#L135-L171","documentation":"RisingWave frontend's ErrorCode::InvalidReference variant, rendered as \"Invalid reference: {0}\". It is raised by the binder when a column/index reference cannot be resolved in the current bind context — e.g. BindContext::get_unqualified_name/get_index_by_name fallthrough (src/frontend/src/binder/bind_context.rs:451,482) and column binding (src/frontend/src/binder/expr/column.rs:83).","triggerScenarios":"Referencing a column not visible in the current scope (wrong correlation, outside a subquery); using an invalid ordinal/column reference in ORDER BY/GROUP BY; referencing an ambiguous or dropped column during binding.","commonSituations":"Typos in column names; referencing an output alias where an input column is required; using a CTE column outside its scope; quoting identifiers with wrong case.","solutions":["Check the exact column name and visibility scope with \\d <table> or SHOW COLUMNS FROM <relation>.","Qualify ambiguous column references with the table/alias name.","If using an alias in ORDER BY/GROUP BY, use the underlying expression or confirm RisingWave supports the alias in that clause.","Verify quoted-identifier case matches the schema (double quotes are case-sensitive)."],"exampleFix":"// before\nSELECT id FROM t ORDER BY oops;\n// after\nSELECT id FROM t ORDER BY id; -- or a column that exists in t","handlingStrategy":"validation","validationCode":"-- before query\nSELECT column_name FROM information_schema.columns WHERE table_name = 't';\n-- ensure every referenced column appears here and in the FROM scope","typeGuard":null,"tryCatchPattern":"try { await db.query(sql) } catch (e) {\n  if (/Invalid reference:/.test(e.message)) { validateColumns(sql); throw e; }\n  throw e;\n}","preventionTips":["Qualify columns with table/alias names in multi-table queries.","Do not use SELECT output aliases where input columns are required.","Double-check quoted identifier casing after schema changes."],"tags":["sql","binder","risingwave","column-reference"],"backgroundTag":"invalid-argument-value","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}