{"record":{"id":"e9951a97ee642dbe","repo":"prestodb/presto","slug":"lance-error","errorCode":"LANCE_ERROR","errorMessage":"Failed to read Arrow batch","messagePattern":"Failed to read Arrow batch","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-lance/src/main/java/com/facebook/presto/lance/LanceArrowToPageScanner.java","lineNumber":88,"sourceCode":"    public boolean read()\n    {\n        try {\n            boolean hasNext = arrowReader.loadNextBatch();\n            if (hasNext) {\n                VectorSchemaRoot root = arrowReader.getVectorSchemaRoot();\n                lastBatchBytes = 0;\n                for (FieldVector vector : root.getFieldVectors()) {\n                    for (ArrowBuf buf : vector.getFieldBuffers()) {\n                        if (buf != null) {\n                            lastBatchBytes += buf.capacity();\n                        }\n                    }\n                }\n            }\n            return hasNext;\n        }\n        catch (IOException e) {\n            throw new PrestoException(LanceErrorCode.LANCE_ERROR, \"Failed to read Arrow batch\", e);\n        }\n    }\n\n    public long getLastBatchBytes()\n    {\n        return lastBatchBytes;\n    }\n\n    public Page convert()\n    {\n        VectorSchemaRoot root;\n        try {\n            root = arrowReader.getVectorSchemaRoot();\n        }\n        catch (IOException e) {\n            throw new PrestoException(LanceErrorCode.LANCE_ERROR, \"Failed to get VectorSchemaRoot\", e);\n        }\n","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-lance/src/main/java/com/facebook/presto/lance/LanceArrowToPageScanner.java#L70-L106","documentation":"The Lance connector failed while reading the next Arrow record batch from the Lance scanner, wrapping an IOException into a PrestoException with LANCE_ERROR. This indicates the underlying Arrow/Lance reader (RecordBatchReader) hit an I/O problem mid-scan, so the split cannot produce more pages.","triggerScenarios":"Calling LanceArrowToPageScanner.read/hasNext when the underlying arrowReader throws IOException while loading the next batch — corrupt fragment files, deleted/compacted data files during the scan, storage (object store/HDFS) read failures, or network interruptions.","commonSituations":"Lance table files removed or rewritten by a concurrent compaction/write while a long-running query scans them; transient S3/GCS errors; disk or permission issues on local storage; version mismatch between the Lance runtime and dataset format.","solutions":["Retry the query; transient storage/network failures often resolve on re-run","Check that the Lance dataset files still exist and were not compacted/deleted mid-query; avoid concurrent compaction during reads, or pin to a stable dataset version","Inspect the wrapped IOException cause for storage-specific diagnostics (permissions, missing objects, throttling)","Verify Lance library and dataset format version compatibility"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check storage accessibility before starting the scan\ntry (FileReader reader = new FileReader(path)) {\n    if (!Files.exists(path)) throw new IllegalStateException(\"dataset files missing\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    pages = scanner.read(...);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getName().contains(\"LANCE\")) {\n        // inspect e.getCause() (IOException); retry or fail the split\n    }\n}","preventionTips":["Avoid compacting/rewriting Lance datasets while queries are running","Use stable dataset version pinning for long scans","Monitor object-store health and set sane retry policies","Keep Lance/Arrow library versions aligned with dataset format"],"tags":["presto","lance","arrow","io"],"backgroundTag":"storage-io-failure","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"}