[Bug] Service fails to start ("No usable account") if a disabled account has cached models requiring higher tier
发生了什么 / What happened
Environment
- Version: v0.3.12 (Windows amd64)
- WAA Backend: SpiderMonkey
Description
When a Pro/Ultra account that has previously cached high-tier models (such as deep-research-preview-04-2026) is set to Disabled, and only Free accounts remain enabled, the generation service fails to start with the error:
"No usable account. Add or enable an account, or check the status of existing accounts on the Accounts page"
In runtime/logs/aistudio2api.log:
{
"level": "ERROR",
"msg": "生成服务启动失败",
"error": "没有可预热的账户: 模型 deep-research-preview-04-2026 需要以下任一权益,启用的账户都不具备:付费 API key;Google AI Pro 或 Ultra 订阅"
}
Steps to Reproduce
- Add an account with Google AI Pro / Ultra subscription (it populates
catalog.jsonwith Pro-only models likedeep-research-preview-04-2026). - Add one or more Free accounts.
- Disable the Pro account (toggle to
Disabled/enabled: false). - Click Start service.
Expected Behavior
The service should start using only the enabled Free accounts, serving models available to them, while ignoring models that only belong to disabled accounts.
Actual Behavior
The service crashes into STOPPED state and refuses to launch.
Root Cause Analysis
In internal/app/worker_manager.go inside classifyBootstrapCandidates (~line 806):
for _, status := range manager.pool.Status() {
models, err := manager.pool.BootstrapModels(status.ID)
if err != nil {
continue
}
for _, modelID := range models {
if _, exists := seenModels[modelID]; exists {
continue
}
seenModels[modelID] = struct{}{}
modelIDs = append(modelIDs, modelID)
}
}
manager.pool.Status()returns all accounts, including disabled ones (status.Enabled == false). It readsBootstrapModelsfromcatalog.jsonof disabled accounts, pollutingmodelIDswith Pro-only models.- In the subsequent loop (~line 820),
manager.pool.ClassifyCandidates()checks for eligible accounts among enabled accounts. Since none of the enabled accounts possess Pro/Ultra tier, it returnsModelAccessError. - Instead of skipping the inaccessible model,
classifyBootstrapCandidatesimmediately returns the error, aborting the entire bootstrap process.
Suggested Fix
- Skip disabled accounts when gathering bootstrap model IDs in
classifyBootstrapCandidates:
for _, status := range manager.pool.Status() {
if !status.Enabled {
continue
}
models, err := manager.pool.BootstrapModels(status.ID)
// ...
}
- Additionally, in the candidate classification loop, consider skipping models that return
ModelAccessErrorrather than aborting the entire startup if other models have eligible accounts.
版本 / Version
v0.3.12
alr fixed in v0.3.13, see https://github.com/Mag1cFall/AIStudio2API/issues/201