{"record":{"id":"0fed427b3ed23d63","repo":"prestodb/presto","slug":"invalid-evaluation-state","errorCode":null,"errorMessage":"invalid evaluation state","messagePattern":"invalid evaluation state","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/reader/SliceDictionarySelectiveReader.java","lineNumber":263,"sourceCode":"                else {\n                    switch (evaluationStatus[index]) {\n                        case FILTER_FAILED: {\n                            break;\n                        }\n                        case FILTER_PASSED: {\n                            if (context.isOutputRequired()) {\n                                values[outputPositionCount] = index;\n                            }\n                            outputPositions[outputPositionCount] = position;\n                            outputPositionCount++;\n                            break;\n                        }\n                        case FILTER_NOT_EVALUATED: {\n                            evaluationStatus[index] = evaluateFilter(position, index, length);\n                            break;\n                        }\n                        default: {\n                            throw new IllegalStateException(\"invalid evaluation state\");\n                        }\n                    }\n                }\n            }\n            streamPosition++;\n\n            if (filter != null) {\n                outputPositionCount -= filter.getPrecedingPositionsToFail();\n                int succeedingPositionsToFail = filter.getSucceedingPositionsToFail();\n                if (succeedingPositionsToFail > 0) {\n                    int positionsToSkip = 0;\n                    for (int j = 0; j < succeedingPositionsToFail; j++) {\n                        i++;\n                        int nextPosition = positions[i];\n                        positionsToSkip += 1 + nextPosition - streamPosition;\n                        streamPosition = nextPosition + 1;\n                    }\n                    skip(positionsToSkip);","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/reader/SliceDictionarySelectiveReader.java#L245-L281","documentation":"readWithFilter tracks per-position filter evaluation state; each position must be in one of three known states. Reaching the default branch means the internal state machine invariant was violated, so an IllegalStateException is thrown — typically a library bug rather than user error.","triggerScenarios":"Calling read() with a filter on a dictionary-encoded string column when a position's evaluationStatus value is none of FILTER_NOT_EVALUATED, and the other handled states (an internal enum/int state not produced by the reader's own logic).","commonSituations":"Library bug or stale/Presto version mismatch where reader internals and filter plumbing disagree; extremely rare at runtime, usually surfaced by fuzzing or a regression in a filter implementation.","solutions":["Note the exact query, file, and Presto version and file a bug with the stack trace.","Retry after upgrading Presto to a version containing reader fixes.","Work around by rewriting the query to avoid the specific filter shape (e.g. simplify or reorder predicates).","As a last resort read the column without dictionary-selective path by rewriting the file with direct encoding."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return reader.read();\n} catch (IllegalStateException e) {\n    if (e.getMessage().equals(\"invalid evaluation state\")) {\n        log.error(\"Reader internal state bug; report with stack trace\", e);\n    }\n    throw e;\n}","preventionTips":["Upgrade Presto before reporting; this is an internal invariant violation.","Include the query plan, file, and stack trace when filing the bug.","Simplify or reorder filter predicates as a temporary workaround."],"tags":["orc","illegal-state","internal-bug","filter"],"backgroundTag":"illegal-state-internal-invariant","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"}