{"record":{"id":"a97eedd567c1f319","repo":"prestodb/presto","slug":"not-on-a-valid-row","errorCode":null,"errorMessage":"Not on a valid row","messagePattern":"Not on a valid row","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java","lineNumber":1667,"sourceCode":"\n    void partialCancel()\n    {\n        client.cancelLeafStage();\n    }\n\n    private void checkOpen()\n            throws SQLException\n    {\n        if (isClosed()) {\n            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","sourceCodeStart":1649,"sourceCodeEnd":1685,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java#L1649-L1685","documentation":"checkValidRow is a guard called before column access: when the cursor is not positioned on a row (before first, after last, or a null row slot) it throws this SQLException. Reading a column is only legal after next() has returned true and before it returns false.","triggerScenarios":"Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:1667 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call next() and confirm it returned true before reading any column values","Do not read columns after the result set is exhausted","Restructure loops so getters only run inside the while(next()) body"],"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"}