{"record":{"id":"ae352445cc64be09","repo":"chenhg5/cc-connect","slug":"yuanbao-bot-token-is-required-format-app-key-ap","errorCode":null,"errorMessage":"yuanbao: bot_token is required (format: app_key:app_secret)","messagePattern":"yuanbao: bot_token is required \\(format: app_key:app_secret\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"platform/yuanbao/platform.go","lineNumber":70,"sourceCode":"\theartbeatTimer     *time.Timer\n\tdedupCleanupTimer  *time.Timer\n\tdedupSet           map[string]time.Time\n\treplyHBTimers      map[string]*time.Timer\n\treplyHBStop        map[string]chan struct{}\n\treconnectAttempts  int\n\tshouldReconnect    bool\n\tdone               chan struct{}\n\tpendingAcks        map[string]chan<- []byte\n\tpendingMu          sync.Mutex\n\tconsecutiveHbFails int\n}\n\nfunc New(opts map[string]any) (core.Platform, error) {\n\tbotToken, _ := opts[\"bot_token\"].(string)\n\tappKey, appSecret := splitBotToken(botToken)\n\tallowFrom, _ := opts[\"allow_from\"].(string)\n\tif appKey == \"\" || appSecret == \"\" {\n\t\treturn nil, fmt.Errorf(\"yuanbao: bot_token is required (format: app_key:app_secret)\")\n\t}\n\tapiDomain, _ := opts[\"api_domain\"].(string)\n\twsURL, _ := opts[\"ws_url\"].(string)\n\trouteEnv, _ := opts[\"route_env\"].(string)\n\tif apiDomain == \"\" {\n\t\tapiDomain = defaultAPIDomain\n\t}\n\tif wsURL == \"\" {\n\t\twsURL = defaultWSURL\n\t}\n\tcore.CheckAllowFrom(\"yuanbao\", allowFrom)\n\treturn &Platform{\n\t\tappKey: appKey, appSecret: appSecret, allowFrom: allowFrom,\n\t\tapiDomain: apiDomain, wsURL: wsURL, routeEnv: routeEnv,\n\t\ttokens:        newTokenManager(),\n\t\tdedupSet:      make(map[string]time.Time),\n\t\treplyHBTimers: make(map[string]*time.Timer),\n\t\treplyHBStop:   make(map[string]chan struct{}),","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/yuanbao/platform.go#L52-L88","documentation":"The yuanbao platform constructor requires a bot_token option in \"app_key:app_secret\" format; if the token is missing or splitting on \":\" yields an empty app_key or app_secret, New returns this error. Configuration is rejected at startup rather than failing later at connection time.","triggerScenarios":"Creating the platform with opts lacking \"bot_token\", an empty string, a token without the \":\" separator, or an empty app_key/app_secret segment.","commonSituations":"Forgot to fill in bot_token in config.toml; pasted only the app_key without appending \":app_secret\"; env var substitution produced an empty string; whitespace or quoting issues stripped the secret.","solutions":["Set bot_token in the yuanbao config block to \"app_key:app_secret\" with both parts non-empty","Verify the credentials come from the yuanbao open-platform console and contain exactly one \":\"","Check config loading/env substitution isn't producing an empty value","Remove stray quotes or whitespace around the token"],"exampleFix":"// before (config.toml)\n[platform.yuanbao]\n# bot_token = \"\"   # missing\n// after\n[platform.yuanbao]\nbot_token = \"your_app_key:your_app_secret\"","handlingStrategy":"validation","validationCode":"parts := strings.SplitN(cfg.BotToken, \":\", 2)\nif len(parts) != 2 || parts[0] == \"\" || parts[1] == \"\" { return errors.New(\"bot_token must be app_key:app_secret\") }","typeGuard":null,"tryCatchPattern":"pl, err := platform.New(opts); if err != nil && strings.Contains(err.Error(), \"bot_token is required\") { slog.Fatal(\"yuanbao misconfigured: set bot_token = \\\"app_key:app_secret\\\"\") }","preventionTips":["Validate config.toml at deploy time before startup","Store credentials via env vars with startup presence checks","Never paste only the app_key; always include \":app_secret\""],"tags":["config","authentication","startup"],"backgroundTag":"missing-required-config-field","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}