{"record":{"id":"3cf945a42ee54584","repo":"apache/flink","slug":"unexpected-trigger-result-triggerresult","errorCode":null,"errorMessage":"Unexpected trigger result:{triggerResult}","messagePattern":"Unexpected trigger result:(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/sink/compactor/operator/CompactCoordinator.java","lineNumber":134,"sourceCode":"        if (!committable.hasPendingFile()) {\n            throw new RuntimeException(\"Committable to compact has no content.\");\n        }\n\n        CompactTrigger trigger =\n                triggers.computeIfAbsent(bucketId, id -> new CompactTrigger(strategy));\n        CompactTriggerResult triggerResult = trigger.onElement(committable);\n        switch (triggerResult) {\n            case PASS_THROUGH:\n                bucketRequest.addToPassthrough(committable);\n                return false;\n            case CONTINUE:\n                bucketRequest.addToCompact(committable);\n                return false;\n            case FIRE_AND_PURGE:\n                bucketRequest.addToCompact(committable);\n                return true;\n            default:\n                throw new RuntimeException(\"Unexpected trigger result:\" + triggerResult);\n        }\n    }\n\n    private void fireAndPurge(String bucketId) {\n        triggers.remove(bucketId);\n        CompactorRequest request = packingRequests.remove(bucketId);\n        if (request != null) {\n            output.collect(new StreamRecord<>(request));\n        }\n    }\n\n    @Override\n    public void endInput() throws Exception {\n        // emit all requests remained\n        for (CompactorRequest request : packingRequests.values()) {\n            output.collect(new StreamRecord<>(request));\n        }\n        packingRequests.clear();","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/sink/compactor/operator/CompactCoordinator.java#L116-L152","documentation":"This is a defensive default-case throw in a switch statement over CompactTriggerResult. The enum has exactly three values (CONTINUE, FIRE_AND_PURGE, PASS_THROUGH), all explicitly handled. This branch should never be reached under normal circumstances — it guards against a future enum addition that is not handled in this switch.","triggerScenarios":"Should never occur in released versions. Would only fire if a new CompactTriggerResult enum constant were added to the enum without updating this switch statement — i.e., an internal development error.","commonSituations":"Not a user-facing error. Would only occur during Flink development if the CompactTriggerResult enum is extended without updating the CompactCoordinator switch statement.","solutions":["This is an internal error; report as a Flink bug if encountered with a released version.","Not fixable from user code — the switch needs to be updated to handle the new enum value.","Check if you are running a custom build of Flink with modified CompactTriggerResult."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// No user-facing validation possible — this is an unreachable defensive guard.\n// Only encountered if the Flink build has a modified CompactTriggerResult enum.","typeGuard":null,"tryCatchPattern":"try {\n    coordinator.processElement(element);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Unexpected trigger result:\")) {\n        // internal development error — report as Flink bug\n    }\n    throw e;\n}","preventionTips":["Use official Flink releases, not custom builds with modified internal enums.","Report this error immediately if encountered — it indicates a Flink bug.","Not preventable from user code."],"tags":["file-sink","compaction","internal","defensive","unreachable"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}