{"record":{"id":"8b5c9b40bfaf27ec","repo":"prestodb/presto","slug":"unexpected-update-mode","errorCode":null,"errorMessage":"unexpected update mode: ","messagePattern":"unexpected update mode: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java","lineNumber":2446,"sourceCode":"                .collect(toImmutableList());\n    }\n\n    private Map<String, Optional<Partition>> getExistingPartitionsByNames(MetastoreContext metastoreContext, String databaseName, String tableName, List<PartitionUpdate> partitionUpdates)\n    {\n        ImmutableMap.Builder<String, Optional<Partition>> existingPartitions = ImmutableMap.builder();\n        ImmutableSet.Builder<String> potentiallyNewPartitions = ImmutableSet.builder();\n\n        for (PartitionUpdate update : partitionUpdates) {\n            switch (update.getUpdateMode()) {\n                case APPEND:\n                    existingPartitions.put(update.getName(), Optional.empty());\n                    break;\n                case NEW:\n                case OVERWRITE:\n                    potentiallyNewPartitions.add(update.getName());\n                    break;\n                default:\n                    throw new IllegalArgumentException(\"unexpected update mode: \" + update.getUpdateMode());\n            }\n        }\n\n        // try to load potentially new partitions in batches to check if any of them exist\n        Lists.partition(ImmutableList.copyOf(potentiallyNewPartitions.build()), maxPartitionBatchSize).stream()\n                .flatMap(partitionNames -> metastore.getPartitionsByNames(metastoreContext, databaseName, tableName, getPartitionNamesWithEmptyVersion(partitionNames)).entrySet().stream()\n                        .filter(entry -> entry.getValue().isPresent()))\n                .forEach(entry -> existingPartitions.put(entry.getKey(), entry.getValue()));\n\n        return existingPartitions.build();\n    }\n\n    @Override\n    public void createView(ConnectorSession session, ConnectorTableMetadata viewMetadata, String viewData, boolean replace)\n    {\n        MetastoreContext metastoreContext = getMetastoreContext(session);\n        SchemaTableName viewName = viewMetadata.getTable();\n        Table table = createTableObjectForViewCreation(","sourceCodeStart":2428,"sourceCodeEnd":2464,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java#L2428-L2464","documentation":"An internal IllegalArgumentException raised while preparing partition updates for a write: the connector's UpdateMode enum (e.g. APPEND, NEW, OVERWRITE, INSERT_EXISTING) encountered a value it does not recognize in its switch statement. This indicates a connector-internal inconsistency or a newer write mode produced by a different code path/version than this switch handles, not a user input problem.","triggerScenarios":"Calling HiveMetadata.finishInsert/applyDelta path where an update row carries an UpdateMode outside {APPEND, NEW, OVERWRITE, INSERT_EXISTING}; typically caused by version mismatch between engine/connector code or a new enum constant added without updating the switch.","commonSituations":"Mixed-version Presto coordinator/worker deployment where one side serializes an update mode the other doesn't know; custom patches adding an UpdateMode constant without updating all switches; corrupted internal state.","solutions":["Ensure all Presto nodes run the same version (no mixed coordinator/worker builds)","Search the codebase for newly added UpdateMode constants and add a case for them in this switch","Reproduce with a minimal query and file a bug with the update mode value","As a workaround, downgrade/align to a single consistent release"],"exampleFix":"// before\ndefault:\n    throw new IllegalArgumentException(\"unexpected update mode: \" + update.getUpdateMode());\n// after\ncase INSERT_EXISTING:\n    // handle the mode that was missing\n    break;\ndefault:\n    throw new IllegalArgumentException(\"unexpected update mode: \" + update.getUpdateMode());","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run identical Presto versions on all nodes","Keep UpdateMode switch statements exhaustive when adding enum constants","Add a test asserting every UpdateMode constant is handled in finishInsert","Avoid patched forks that diverge on internal enums"],"tags":["hive","internal-error","enum","version-mismatch"],"backgroundTag":"unexpected-enum-value","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"}