alibaba/spring-ai-alibaba · error · IllegalStateException
Multiple savers configured, but no specific one requested.
Error message
Multiple savers configured, but no specific one requested.
What it means
SaverConfig.get() throws IllegalStateException when more than one checkpoint saver has been registered via addSaver() but the caller asked for the single default saver. Ambiguous configuration: use getAll() or a type-specific accessor instead.
Source
Thrown at spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/checkpoint/config/SaverConfig.java:53
savers.add(saver);
applyLatestCheckpointCacheConfig(saver);
return this;
}
public SaverConfig latestCheckpointCacheEnabled(boolean enabled) {
this.latestCheckpointCacheEnabled = enabled;
applyLatestCheckpointCacheConfig();
return this;
}
public BaseCheckpointSaver get() {
if (savers.isEmpty()) {
return null;
}
if (savers.size() == 1) {
return savers.get(0);
}
throw new IllegalStateException("Multiple savers configured, but no specific one requested.");
}
public List<BaseCheckpointSaver> getAll() {
return savers;
}
public boolean latestCheckpointCacheEnabled() {
return latestCheckpointCacheEnabled;
}
private void applyLatestCheckpointCacheConfig() {
savers.forEach(this::applyLatestCheckpointCacheConfig);
}
private void applyLatestCheckpointCacheConfig(BaseCheckpointSaver saver) {
if (saver instanceof LatestCheckpointCacheConfigurable configurable) {
configurable.latestCheckpointCacheEnabled(latestCheckpointCacheEnabled);
}View on GitHub (pinned to f82da0b50f)
Solutions
- Configure only one saver in SaverConfig
- Request a specific saver explicitly (by name/type) instead of calling get()
- Use getAll() and pick the desired saver yourself
- Clean up leftover saver registrations from previous config
Example fix
// before
saverConfig.addSaver(h2Saver).addSaver(fileSaver);
BaseCheckpointSaver s = saverConfig.get();
// after
BaseCheckpointSaver s = saverConfig.addSaver(h2Saver).addSaver(fileSaver).get("h2"); Defensive patterns
Strategy: validation
Validate before calling
if (saverConfig.getAll().size() > 1) { /* pick explicitly */ } Type guard
List<BaseCheckpointSaver> all = saverConfig.getAll(); boolean ambiguous = all.size() > 1;
Try / catch
try { return saverConfig.get(); } catch (IllegalStateException e) { return saverConfig.getAll().get(0); } Prevention
- Keep exactly one saver configured for default paths
- Name/select savers explicitly when using multiple
- Audit SaverConfig setup code after adding savers
When it happens
Trigger: Configuring two or more BaseCheckpointSaver instances in SaverConfig (e.g. both H2 and file savers) and calling get() without naming/choosing a specific saver.
Common situations: Developers adding a second saver for migration or backup purposes and then calling generic graph-compile paths that call SaverConfig.get().
Related errors
- maxCachedThreads must be greater than or equal to 0
- oss ak or sk should be set.
- oss bucket should be set.
- AppNotFound
- Unsupported vector store type:
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/2b928bf8871fb2b6.
Report an issue: GitHub.