chenhg5/cc-connect · error
project %q has no weixin platform
Error message
project %q has no weixin platform
What it means
SaveWeixinPlatformCredentials requires the target project's config to contain at least one platform block whose type is "weixin" (case-insensitive, trimmed). It scans proj.Platforms collecting matching candidates; if none match, it refuses to proceed rather than silently creating one. This guards the raw-TOML span editor from writing credentials into a nonexistent weixin block.
Source
Thrown at config/config.go:2433
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 == "weixin" {
candidates = append(candidates, i)
}
}
if len(candidates) == 0 {
return nil, fmt.Errorf("project %q has no weixin 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 weixin 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 platform block with type = "weixin" under the named project in config.toml
- Fix the platform's type field if it's a typo (e.g. "wechat" -> "weixin")
- Run the platform provisioning/setup command for weixin first so the block is created, then retry the credential update
- Verify the project name in opts.ProjectName matches the intended project that actually has a weixin platform
Example fix
// before (config.toml) [[projects.platforms]] type = "wechat" // after [[projects.platforms]] type = "weixin"
Defensive patterns
Strategy: validation
Validate before calling
func hasWeixinPlatform(cfg *config.Config, project string) bool {
for _, p := range cfg.Projects {
if p.Name != project { continue }
for _, pl := range p.Platforms {
if strings.ToLower(strings.TrimSpace(pl.Type)) == "weixin" { return true }
}
}
return false
} Prevention
- Always declare a [[projects.platforms]] block with type = "weixin" before running WeChat credential setup
- Grep config.toml for the platform type spelling; "wechat" will not match
- Run platform provisioning before credential updates
When it happens
Trigger: Calling SaveWeixinPlatformCredentials with opts.ProjectName naming a project whose platforms array contains no entry with type == "weixin" (e.g. only feishu/telegram), or a misspelled type value like "wechat" or "weixin" with stray characters.
Common situations: User set up a project with the wrong platform type, typo'd "weixin" in config.toml, or runs the WeChat credential setup flow (e.g. QR login) against a project configured for a different messaging platform.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- reload config: %w
- config: %s.mode must be "full", "compact", or "quiet"
- config: %s.card_mode must be "legacy" or "rich"
- encode config: %w
- platform index %d out of range: project %q has %d weixin pla
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/243ea0d1fbb55b8c.
Report an issue: GitHub.