chenhg5/cc-connect · error
project %q has no yuanbao platform
Error message
project %q has no yuanbao platform
What it means
Returned when the located project's Platforms array contains no entry whose Type (lowercased, trimmed) equals "yuanbao". The operation only manipulates yuanbao-type platforms, so a project without at least one is rejected.
Source
Thrown at config/config.go:2743
if cfg.Projects[i].Name == opts.ProjectName {
projectIdx = i
break
}
}
if projectIdx < 0 {
return nil, fmt.Errorf("project %q not found", opts.ProjectName)
}
proj := &cfg.Projects[projectIdx]
candidates := make([]int, 0, len(proj.Platforms))
for i := range proj.Platforms {
t := strings.ToLower(strings.TrimSpace(proj.Platforms[i].Type))
if t == "yuanbao" {
candidates = append(candidates, i)
}
}
if len(candidates) == 0 {
return nil, fmt.Errorf("project %q has no yuanbao platform", opts.ProjectName)
}
targetPos := 0
if opts.PlatformIndex > 0 {
targetPos = opts.PlatformIndex - 1
}
if targetPos < 0 || targetPos >= len(candidates) {
return nil, fmt.Errorf(
"platform index %d out of range: project %q has %d yuanbao platform(s)",
opts.PlatformIndex, opts.ProjectName, len(candidates),
)
}
absIdx := candidates[targetPos]
platform := &proj.Platforms[absIdx]
if platform.Options == nil {
platform.Options = map[string]any{}
}View on GitHub (pinned to 4000b2338a)
Solutions
- Add a yuanbao platform to the project first (`[[projects.platforms]] type = "yuanbao"` with its token/options)
- Verify the target project actually hosts the yuanbao bot: check its platforms' type values in config.toml
- Correct the Type field if it was renamed to something else
Example fix
// before type = "yuanbao_web" // not matched // after [[projects.platforms]] type = "yuanbao"
Defensive patterns
Strategy: validation
Validate before calling
proj := findProject(cfg, opts.ProjectName)
if !slices.ContainsFunc(proj.Platforms, func(p PlatformCfg) bool {
return strings.EqualFold(strings.TrimSpace(p.Type), "yuanbao")
}) {
return fmt.Errorf("project %q has no yuanbao platform", opts.ProjectName)
} Type guard
func hasYuanbaoPlatform(proj ProjectCfg) bool {
for _, p := range proj.Platforms {
if strings.EqualFold(strings.TrimSpace(p.Type), "yuanbao") { return true }
}
return false
} Try / catch
if err != nil {
if strings.Contains(err.Error(), "has no yuanbao platform") {
slog.Error("add a yuanbao platform to the project first", "err", err)
return err
}
return err
} Prevention
- Verify the project's platform types before running yuanbao-specific operations
- Keep the Type literal exactly "yuanbao" in config.toml
- Create the platform entry before attempting token updates
When it happens
Trigger: Calling a yuanbao platform operation against a project whose platforms are all feishu/telegram/etc.; a platform typed "Yuanbao " with odd casing would still match (it's normalized), but "yuanbao-web" or "yb" will not; the yuanbao platform was removed from the project earlier.
Common situations: Pointing a yuanbao credential-update command at the wrong project; refactoring platform Type strings in config.toml to non-standard values; a config migrated from another tool that named the platform differently.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- cron project not found
- project %q not found in config
- provider %q not found in project %q
- command %q not found
- alias %q not found
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/689c6f616eb06218.
Report an issue: GitHub.