{"record":{"id":"689c6f616eb06218","repo":"chenhg5/cc-connect","slug":"project-q-has-no-yuanbao-platform","errorCode":null,"errorMessage":"project %q has no yuanbao platform","messagePattern":"project %q has no yuanbao platform","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/config.go","lineNumber":2743,"sourceCode":"\t\tif cfg.Projects[i].Name == opts.ProjectName {\n\t\t\tprojectIdx = i\n\t\t\tbreak\n\t\t}\n\t}\n\tif projectIdx < 0 {\n\t\treturn nil, fmt.Errorf(\"project %q not found\", opts.ProjectName)\n\t}\n\n\tproj := &cfg.Projects[projectIdx]\n\tcandidates := make([]int, 0, len(proj.Platforms))\n\tfor i := range proj.Platforms {\n\t\tt := strings.ToLower(strings.TrimSpace(proj.Platforms[i].Type))\n\t\tif t == \"yuanbao\" {\n\t\t\tcandidates = append(candidates, i)\n\t\t}\n\t}\n\tif len(candidates) == 0 {\n\t\treturn nil, fmt.Errorf(\"project %q has no yuanbao platform\", opts.ProjectName)\n\t}\n\n\ttargetPos := 0\n\tif opts.PlatformIndex > 0 {\n\t\ttargetPos = opts.PlatformIndex - 1\n\t}\n\tif targetPos < 0 || targetPos >= len(candidates) {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"platform index %d out of range: project %q has %d yuanbao platform(s)\",\n\t\t\topts.PlatformIndex, opts.ProjectName, len(candidates),\n\t\t)\n\t}\n\n\tabsIdx := candidates[targetPos]\n\tplatform := &proj.Platforms[absIdx]\n\tif platform.Options == nil {\n\t\tplatform.Options = map[string]any{}\n\t}","sourceCodeStart":2725,"sourceCodeEnd":2761,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/config/config.go#L2725-L2761","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ntype = \"yuanbao_web\" // not matched\n// after\n[[projects.platforms]]\ntype = \"yuanbao\"","handlingStrategy":"validation","validationCode":"proj := findProject(cfg, opts.ProjectName)\nif !slices.ContainsFunc(proj.Platforms, func(p PlatformCfg) bool {\n    return strings.EqualFold(strings.TrimSpace(p.Type), \"yuanbao\")\n}) {\n    return fmt.Errorf(\"project %q has no yuanbao platform\", opts.ProjectName)\n}","typeGuard":"func hasYuanbaoPlatform(proj ProjectCfg) bool {\n    for _, p := range proj.Platforms {\n        if strings.EqualFold(strings.TrimSpace(p.Type), \"yuanbao\") { return true }\n    }\n    return false\n}","tryCatchPattern":"if err != nil {\n    if strings.Contains(err.Error(), \"has no yuanbao platform\") {\n        slog.Error(\"add a yuanbao platform to the project first\", \"err\", err)\n        return err\n    }\n    return err\n}","preventionTips":["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"],"tags":["config","not-found","platform"],"backgroundTag":"resource-not-found","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}