prestodb/presto · error · SQLException
Not on a valid row
Error message
Not on a valid row
What it means
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.
Source
Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:1667
void partialCancel()
{
client.cancelLeafStage();
}
private void checkOpen()
throws SQLException
{
if (isClosed()) {
throw new SQLException("ResultSet is closed");
}
}
private void checkValidRow()
throws SQLException
{
if (row.get() == null) {
throw new SQLException("Not on a valid row");
}
}
private Object column(int index)
throws SQLException
{
checkOpen();
checkValidRow();
if ((index <= 0) || (index > resultSetMetaData.getColumnCount())) {
throw new SQLException("Invalid column index: " + index);
}
Object value = row.get().get(index - 1);
wasNull.set(value == null);
return value;
}
private ColumnInfo columnInfo(int index)
throws SQLExceptionView on GitHub (pinned to 55bb57d202)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java:1667 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/a97eedd567c1f319.
Report an issue: GitHub.