apache/flink · error · RuntimeException
Unable to find value class.
Error message
Unable to find value class.
What it means
Thrown by HadoopInputFormatBase.readFields when Class.forName(valueClassName) fails during deserialization. The value class is the second generic type of the InputFormat pair; like the key class, it must be resolvable on the task's classpath when the format is deserialized.
Source
Thrown at flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/HadoopInputFormatBase.java:319
try {
this.keyClass =
(Class<K>)
Class.forName(
keyClassName,
true,
Thread.currentThread().getContextClassLoader());
} catch (Exception e) {
throw new RuntimeException("Unable to find key class.", e);
}
try {
this.valueClass =
(Class<V>)
Class.forName(
valueClassName,
true,
Thread.currentThread().getContextClassLoader());
} catch (Exception e) {
throw new RuntimeException("Unable to find value class.", e);
}
ReflectionUtils.setConf(mapredInputFormat, jobConf);
jobConf.getCredentials().addAll(this.credentials);
Credentials currentUserCreds = getCredentialsFromUGI(UserGroupInformation.getCurrentUser());
if (currentUserCreds != null) {
jobConf.getCredentials().addAll(currentUserCreds);
}
}
}
View on GitHub (pinned to 2f3c205e92)
Solutions
- Include the JAR containing the value class in the Flink job submission classpath.
- For custom value types, package them in the fat JAR or add via -C.
- Inspect getCause() for the exact ClassNotFoundException message.
- Verify that the value class has the same fully qualified name and package as when the format was serialized.
Defensive patterns
Strategy: validation
Validate before calling
// Validate value class is on the classpath before job submission
try {
Class.forName(valueClassName, false, Thread.currentThread().getContextClassLoader());
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException(
"Value class not on classpath: " + valueClassName + ". Add the required JAR.", e);
} Prevention
- Include the JAR with the value type class in the job submission.
- For custom value types, package them in the fat JAR.
- Verify all Writable classes are resolvable before deploying.
When it happens
Trigger: Restoring or deploying a HadoopInputFormat job where the value type class is not on the task classpath.
Common situations: Missing Hadoop common JAR (for standard types like Text, IntWritable); custom value class not in the submitted JAR; classpath isolation or classloader ordering issue.
Related errors
- Unable to instantiate the hadoop input format
- Unable to find key class.
- Unable to instantiate the hadoop output format
- The program's entry point class '{className}' could not be l
- Could not load class for serialization config
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/232267dac08ee48f.
Report an issue: GitHub.