apache/flink · error · RuntimeException

Can not new instance for custom class from

Error message

Can not new instance for custom class from %s

What it means

Thrown by PartitionTimeExtractor.create in the CUSTOM branch when the user-classloader cannot instantiate the configured custom extractor class — ClassNotFoundException, IllegalAccessException, or instantiation failure occurred while doing loadClass(extractorClass).newInstance(). The 'partition.time-extractor.class' option points to a class that is missing, not accessible, or lacks a no-arg constructor.

Solutions

  1. Address the cause reported by the error message: Can not new instance for custom class from the reported value
  2. Verify the inputs, configuration values, and classpath/dependency setup related to this operation, then retry.

Example fix

Correct the condition described ("Can not new instance for custom class from the reported value") and rerun the job or command.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Triggered at runtime when the operation fails because: Can not new instance for custom class from the reported value.

Common situations: Commonly caused by misconfiguration, missing dependencies or files, unsupported types or operations, or invalid user input leading to: Can not new instance for custom class from the reported value.


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

Appendix: source

Thrown at flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/table/PartitionTimeExtractor.java:53

    LocalDateTime extract(List<String> partitionKeys, List<String> partitionValues);

    static PartitionTimeExtractor create(
            ClassLoader userClassLoader,
            String extractorKind,
            String extractorClass,
            String extractorPattern,
            String formatterPattern) {
        switch (extractorKind) {
            case DEFAULT:
                return new DefaultPartTimeExtractor(extractorPattern, formatterPattern);
            case CUSTOM:
                try {
                    return (PartitionTimeExtractor)
                            userClassLoader.loadClass(extractorClass).newInstance();
                } catch (ClassNotFoundException
                        | IllegalAccessException
                        | InstantiationException e) {
                    throw new RuntimeException(
                            "Can not new instance for custom class from " + extractorClass, e);
                }
            default:
                throw new UnsupportedOperationException(
                        "Unsupported extractor kind: " + extractorKind);
        }
    }
}

View on GitHub (pinned to 2f3c205e92)