{"record":{"id":"bfedac0108b7925f","repo":"prestodb/presto","slug":"generic-internal-error-bfedac","errorCode":"GENERIC_INTERNAL_ERROR","errorMessage":"SchedulingPolicy is bucketed, but BucketHandle is not present","messagePattern":"SchedulingPolicy is bucketed, but BucketHandle is not present","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java","lineNumber":292,"sourceCode":"        }\n\n        // get partitions\n        List<HivePartition> partitions = layout.getPartitions()\n                .map(PartitionSet::getFullyLoadedPartitions)\n                .orElseThrow(() -> new PrestoException(GENERIC_INTERNAL_ERROR, \"Layout does not contain partitions\"));\n\n        // short circuit if we don't have any partitions\n        HivePartition partition = Iterables.getFirst(partitions, null);\n        if (partition == null) {\n            return new FixedSplitSource(ImmutableList.of());\n        }\n\n        Optional<HiveBucketFilter> bucketFilter = layout.getBucketFilter();\n\n        // validate bucket bucketed execution\n        Optional<HiveBucketHandle> bucketHandle = layout.getBucketHandle();\n        if ((splitSchedulingContext.getSplitSchedulingStrategy() == GROUPED_SCHEDULING) && !bucketHandle.isPresent()) {\n            throw new PrestoException(GENERIC_INTERNAL_ERROR, \"SchedulingPolicy is bucketed, but BucketHandle is not present\");\n        }\n\n        if (bucketHandle.isPresent()) {\n            if (bucketHandle.get().getReadBucketCount() > bucketHandle.get().getTableBucketCount()) {\n                throw new PrestoException(\n                        GENERIC_INTERNAL_ERROR,\n                        \"readBucketCount (%s) is greater than the tableBucketCount (%s) which generally points to an issue in plan generation\");\n            }\n        }\n\n        // sort partitions\n        partitions = Ordering.natural().onResultOf(HivePartition::getPartitionId).reverse().sortedCopy(partitions);\n\n        Iterable<HivePartitionMetadata> hivePartitions = getPartitionMetadata(\n                metastore,\n                table,\n                tableName,\n                partitions,","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java#L274-L310","documentation":"Grouped (bucketed) split scheduling was requested, but the table layout carries no HiveBucketHandle, so the scheduler cannot assign splits to bucket-aligned workers. Presto treats this as an invariant violation of the plan and throws GENERIC_INTERNAL_ERROR.","triggerScenarios":"getSplits is invoked with splitSchedulingContext.getSplitSchedulingStrategy() == GROUPED_SCHEDULING while layout.getBucketHandle() is empty — e.g. grouped execution enabled for a table Presto resolved as unbucketed.","commonSituations":"Session/catalog settings enabling bucketed execution (hive.bucket-execution) applied to an unbucketed or virtually bucketed table where the plan did not produce a bucket handle; planner/connector version mismatch producing inconsistent layout metadata.","solutions":["Disable grouped execution for this query (e.g. SET SESSION hive.bucket_execution = false or adjust node-selection/scheduling policy).","Verify the table is actually bucketed and that bucketing metadata is present in the metastore.","Upgrade/align coordinator and worker versions; if the plan should have produced a bucket handle, file a bug with the query plan."],"exampleFix":"// before\nSET SESSION node_selection_strategy = BIN_PACKING_DISTRIBUTED; -- with grouped scheduling forced\n// after\nSET SESSION hive.bucket_execution = false;","handlingStrategy":"try-catch","validationCode":"// before running with grouped scheduling\nboolean bucketed = layout.getBucketHandle().isPresent();\nif (!bucketed && useGroupedScheduling) { disableGroupedScheduling(); }","typeGuard":null,"tryCatchPattern":"catch (PrestoException e) { if (e.getErrorCode().getCode() == GENERIC_INTERNAL_ERROR.toErrorCode().getCode()) { /* rerun with hive.bucket_execution=false */ } else throw e; }","preventionTips":["Enable grouped scheduling only for tables confirmed bucketed in the metastore.","Keep coordinator/worker versions aligned.","Check EXPLAIN for a bucket handle before relying on bucketed execution."],"tags":["hive","bucketing","internal-error","scheduling"],"backgroundTag":"bucket-handle-missing","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"}