{"record":{"id":"0be5c9dcffff9232","repo":"prestodb/presto","slug":"offsets-length-is-less-than-positioncount","errorCode":null,"errorMessage":"offsets length is less than positionCount","messagePattern":"offsets length is less than positionCount","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-common/src/main/java/com/facebook/presto/common/block/ArrayBlock.java","lineNumber":91,"sourceCode":"    }\n\n    private static void validateConstructorArguments(int arrayOffset, int positionCount, @Nullable boolean[] valueIsNull, int[] offsets, Block values)\n    {\n        if (arrayOffset < 0) {\n            throw new IllegalArgumentException(\"arrayOffset is negative\");\n        }\n\n        if (positionCount < 0) {\n            throw new IllegalArgumentException(\"positionCount is negative\");\n        }\n\n        if (valueIsNull != null && valueIsNull.length - arrayOffset < positionCount) {\n            throw new IllegalArgumentException(\"isNull length is less than positionCount\");\n        }\n\n        requireNonNull(offsets, \"offsets is null\");\n        if (offsets.length - arrayOffset < positionCount + 1) {\n            throw new IllegalArgumentException(\"offsets length is less than positionCount\");\n        }\n\n        requireNonNull(values, \"values is null\");\n    }\n\n    /**\n     * Use createArrayBlockInternal or fromElementBlock instead of this method.  The caller of this method is assumed to have\n     * validated the arguments with validateConstructorArguments.\n     */\n    private ArrayBlock(int arrayOffset, int positionCount, @Nullable boolean[] valueIsNull, int[] offsets, Block values)\n    {\n        // caller must check arguments with validateConstructorArguments\n        this.arrayOffset = arrayOffset;\n        this.positionCount = positionCount;\n        this.valueIsNull = valueIsNull;\n        this.offsets = offsets;\n        this.values = requireNonNull(values);\n","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-common/src/main/java/com/facebook/presto/common/block/ArrayBlock.java#L73-L109","documentation":"Validation guard in ArrayBlock's constructor-argument checker: the offsets array is too short to hold positionCount+1 entries, so element boundaries cannot be resolved. Like the other checks in validateConstructorArguments, it indicates an internal caller built the offsets array with the wrong length.","triggerScenarios":"Thrown at presto-common/src/main/java/com/facebook/presto/common/block/ArrayBlock.java:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the offsets array has at least positionCount + 1 entries","Fix the producer that sized or populated the offsets array"],"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"}