apache/flink · error · RuntimeException

Unexpected trigger result:{triggerResult}

Error message

Unexpected trigger result:{triggerResult}

What it means

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.

Source

Thrown at flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/sink/compactor/operator/CompactCoordinator.java:134

        if (!committable.hasPendingFile()) {
            throw new RuntimeException("Committable to compact has no content.");
        }

        CompactTrigger trigger =
                triggers.computeIfAbsent(bucketId, id -> new CompactTrigger(strategy));
        CompactTriggerResult triggerResult = trigger.onElement(committable);
        switch (triggerResult) {
            case PASS_THROUGH:
                bucketRequest.addToPassthrough(committable);
                return false;
            case CONTINUE:
                bucketRequest.addToCompact(committable);
                return false;
            case FIRE_AND_PURGE:
                bucketRequest.addToCompact(committable);
                return true;
            default:
                throw new RuntimeException("Unexpected trigger result:" + triggerResult);
        }
    }

    private void fireAndPurge(String bucketId) {
        triggers.remove(bucketId);
        CompactorRequest request = packingRequests.remove(bucketId);
        if (request != null) {
            output.collect(new StreamRecord<>(request));
        }
    }

    @Override
    public void endInput() throws Exception {
        // emit all requests remained
        for (CompactorRequest request : packingRequests.values()) {
            output.collect(new StreamRecord<>(request));
        }
        packingRequests.clear();

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. This is an internal error; report as a Flink bug if encountered with a released version.
  2. Not fixable from user code — the switch needs to be updated to handle the new enum value.
  3. Check if you are running a custom build of Flink with modified CompactTriggerResult.
Defensive patterns

Strategy: try-catch

Validate before calling

// No user-facing validation possible — this is an unreachable defensive guard.
// Only encountered if the Flink build has a modified CompactTriggerResult enum.

Try / catch

try {
    coordinator.processElement(element);
} catch (RuntimeException e) {
    if (e.getMessage().startsWith("Unexpected trigger result:")) {
        // internal development error — report as Flink bug
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Not a user-facing error. Would only occur during Flink development if the CompactTriggerResult enum is extended without updating the CompactCoordinator switch statement.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/3cf945a42ee54584. Report an issue: GitHub.