{"record":{"id":"ca1ef293a83a05e3","repo":"prestodb/presto","slug":"position-is-not-valid","errorCode":null,"errorMessage":"position is not valid","messagePattern":"position is not valid","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-common/src/main/java/com/facebook/presto/common/block/AbstractArrayBlock.java","lineNumber":303,"sourceCode":"    @Override\n    public boolean mayHaveNull()\n    {\n        return getValueIsNull() != null;\n    }\n\n    public <T> T apply(ArrayBlockFunction<T> function, int position)\n    {\n        checkReadablePosition(position);\n\n        int startValueOffset = getOffset(position);\n        int endValueOffset = getOffset(position + 1);\n        return function.apply(getRawElementBlock(), startValueOffset, endValueOffset - startValueOffset);\n    }\n\n    protected final void checkReadablePosition(int position)\n    {\n        if (position < 0 || position >= getPositionCount()) {\n            throw new IllegalArgumentException(\"position is not valid\");\n        }\n    }\n\n    public interface ArrayBlockFunction<T>\n    {\n        T apply(Block block, int startPosition, int length);\n    }\n\n    @Override\n    public Block getBlockUnchecked(int internalPosition)\n    {\n        int startValueOffset = getOffsets()[internalPosition];\n        int endValueOffset = getOffsets()[internalPosition + 1];\n        return getRawElementBlock().getRegion(startValueOffset, endValueOffset - startValueOffset);\n    }\n\n    @Override\n    public boolean isNullUnchecked(int internalPosition)","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-common/src/main/java/com/facebook/presto/common/block/AbstractArrayBlock.java#L285-L321","documentation":"checkReadablePosition is the bounds guard shared by all AbstractArrayBlock accessors: it fires when a caller indexes an array block with a position < 0 or >= positionCount — an out-of-range block access, normally an internal engine bug.","triggerScenarios":"Thrown at presto-common/src/main/java/com/facebook/presto/common/block/AbstractArrayBlock.java:303 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check position against getPositionCount() before access","Fix off-by-one or stale positionCount in the calling loop","Verify the block was not reused after being closed or truncated"],"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"}