alibaba/COLA · error · JobException
not support repositoryType: ${jobProperties.getRepositoryTyp
Error message
not support repositoryType: ${jobProperties.getRepositoryType()} What it means
EnableJobConfiguration.jobRepository builds the JobRepository bean from jobProperties.getRepositoryType(); the switch over RepositoryType has no matching case for the configured value and hits default, throwing JobException 'not support repositoryType'.
Source
Thrown at cola-components/cola-component-job/src/main/java/com/alibaba/cola/job/config/EnableJobConfiguration.java:33
@Slf4j
@Import( {JobProperties.class, DBAutoConfiguration.class, RedisConfig.class, JsonUtil.class})
@ComponentScan("com.alibaba.cola.job")
public class EnableJobConfiguration {
@Resource
private JobProperties jobProperties;
@Bean
public JobRepository jobRepository() {
if (jobProperties.getRepositoryType() == null) {
jobProperties.setRepositoryType(RepositoryType.MEMORY);
}
JobRepository jobRepository = switch (jobProperties.getRepositoryType()) {
case DB -> new DataBaseJobRepository();
case REDIS -> new RedisJobRepository();
case MEMORY -> new MemoryJobRepository();
default -> throw new JobException("not support repositoryType: " + jobProperties.getRepositoryType());
};
log.info("[cola-job]create JobRepository: " + jobRepository.getClass().getSimpleName());
return jobRepository;
}
}
View on GitHub (pinned to 352e1a8675)
Solutions
- Fix the repository-type config value to one of DB, REDIS, MEMORY
- Check the RepositoryType enum for valid constants and match spelling/case
- If adding a new repository type, extend the switch in EnableJobConfiguration.jobRepository
Example fix
// before
cola:
job:
repository-type: jdbc
// after
cola:
job:
repository-type: DB Defensive patterns
Strategy: validation
Validate before calling
RepositoryType type = jobProperties.getRepositoryType();
if (type != RepositoryType.DB && type != RepositoryType.REDIS && type != RepositoryType.MEMORY) {
throw new IllegalStateException("Unsupported repositoryType: " + type);
} Try / catch
try {
jobRepository = enableJobConfiguration.jobRepository();
} catch (JobException e) {
if (e.getMessage().startsWith("not support repositoryType")) {
log.error("Fix cola.job.repository-type; valid values: DB, REDIS, MEMORY", e);
throw e;
}
} Prevention
- Copy enum constant names exactly into config (case-sensitive)
- List valid values next to the config key in your README/schema
- Validate config at startup with a fail-fast check
When it happens
Trigger: Setting spring property cola.job.repository-type to a value that is not DB, REDIS, or MEMORY (e.g. a typo or a string not mapping to the enum).
Common situations: Typo in application.yml ('memmory', 'jdbc'); a RepositoryType enum value added in a newer version but switch not updated; config binding to a custom enum constant.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Unexpected value '${value}'
- EXTENSION_NOT_FOUND
- BizScenario can not be null for extension
- EXTENSION_DEFINE_DUPLICATE
- EXTENSION_ILLEGAL
AI-assisted analysis of alibaba/COLA@352e1a8675 (2026-09-08).
Data as JSON: /api/errors/1a3f72c26a9892e7.
Report an issue: GitHub.