chenhg5/cc-connect · error

yuanbao: bot_token is required (format: app_key:app_secret)

Error message

yuanbao: bot_token is required (format: app_key:app_secret)

What it means

VerifyCredentials rejects the call when either app_key or app_secret is empty/whitespace, before any network call is made. The yuanbao bot_token config value must be in `app_key:app_secret` format; this guard surfaces a config problem clearly during `cc-connect yuanbao setup` instead of letting the platform fail later in a background retry loop.

Source

Thrown at platform/yuanbao/sign.go:201

		}
		if result.Data == nil {
			return nil, fmt.Errorf("yuanbao: sign token response missing data")
		}
		return &tokenData{
			token: result.Data.Token, botID: result.Data.BotID,
			duration: result.Data.Duration, product: result.Data.Product,
			source: result.Data.Source,
		}, nil
	}
	return nil, lastErr
}

// VerifyCredentials probes the sign-token API with app_key/app_secret and
// returns the bot_id on success. Used by `cc-connect yuanbao setup` so users
// see a clear error before the platform starts retrying on a background loop.
func VerifyCredentials(appKey, appSecret, apiDomain, routeEnv string) (botID string, err error) {
	if strings.TrimSpace(appKey) == "" || strings.TrimSpace(appSecret) == "" {
		return "", fmt.Errorf("yuanbao: bot_token is required (format: app_key:app_secret)")
	}
	data, err := fetchToken(appKey, appSecret, apiDomain, routeEnv)
	if err != nil {
		return "", err
	}
	return strings.TrimSpace(data.botID), nil
}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Set bot_token in config.toml to `app_key:app_secret`, e.g. bot_token = "abc123:shhh-secret".
  2. Run `cc-connect yuanbao setup` to validate the token interactively before starting the platform.
  3. Check for quoting mistakes that drop part of the value (secret containing special characters should be fine inside TOML quotes).
  4. If the secret is stored in an env-injection system, confirm it is actually populated at daemon start.

Example fix

// before (config.toml)
bot_token = ""
// after
bot_token = "app_key_value:app_secret_value"
Defensive patterns

Strategy: validation

Validate before calling

parts := strings.SplitN(strings.TrimSpace(botToken), ":", 2)
if len(parts) != 2 || parts[0] == "" || parts[1] == "" {
    return errors.New("bot_token must be app_key:app_secret")
}

Prevention

When it happens

Trigger: Calling VerifyCredentials (or `cc-connect yuanbao setup`) with an empty bot_token, a token missing the `:` separator yielding an empty secret, or a value of only whitespace.

Common situations: Fresh install where bot_token was left empty in config.toml, user pasted only the app_key without the secret, or split the token into the wrong config fields.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/07702e8c53a84867. Report an issue: GitHub.