{"record":{"id":"34fe78fa097ec0d0","repo":"prestodb/presto","slug":"invalid-column-index","errorCode":null,"errorMessage":"Invalid column index: ","messagePattern":"Invalid column index: ","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java","lineNumber":1677,"sourceCode":"            throw new SQLException(\"ResultSet is closed\");\n        }\n    }\n\n    private void checkValidRow()\n            throws SQLException\n    {\n        if (row.get() == null) {\n            throw new SQLException(\"Not on a valid row\");\n        }\n    }\n\n    private Object column(int index)\n            throws SQLException\n    {\n        checkOpen();\n        checkValidRow();\n        if ((index <= 0) || (index > resultSetMetaData.getColumnCount())) {\n            throw new SQLException(\"Invalid column index: \" + index);\n        }\n        Object value = row.get().get(index - 1);\n        wasNull.set(value == null);\n        return value;\n    }\n\n    private ColumnInfo columnInfo(int index)\n            throws SQLException\n    {\n        checkOpen();\n        checkValidRow();\n        if ((index <= 0) || (index > columnInfoList.size())) {\n            throw new SQLException(\"Invalid column index: \" + index);\n        }\n        return columnInfoList.get(index - 1);\n    }\n\n    private Object column(String label)","sourceCodeStart":1659,"sourceCodeEnd":1695,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java#L1659-L1695","documentation":"In the private column(index) accessor, checkOpen() and checkValidRow() run first, then the 1-based index is bounds-checked against the column count; out-of-range values (<=0 or greater than getColumnCount()) throw this SQLException. It is a bounds-validation error caused by an invalid column index argument.","triggerScenarios":"Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:1677 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use valid 1-based indices from 1 through ResultSetMetaData.getColumnCount()","Derive indices from getFindColumn/getColumnCount rather than hard-coding","Catch SQLException for dynamic column access paths and validate index first"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}