chenhg5/cc-connect · error

use either --app or --app-id/--app-secret, not both

Error message

use either --app or --app-id/--app-secret, not both

What it means

resolveFeishuSetupInputs normalizes credentials for `cc-connect feishu setup`. The --app flag takes an id:secret pair while --app-id/--app-secret take the halves individually; the two styles are mutually exclusive. This error is thrown when --app is combined with either half flag, preventing ambiguous duplicate credentials.

Source

Thrown at cmd/cc-connect/feishu.go:386

Examples:
  # Recommended: one command for both flows
  cc-connect feishu setup --project my-project
  cc-connect feishu setup --project my-project --app cli_xxx:sec_xxx

  # Equivalent to "setup --app ..."
  cc-connect feishu bind --project my-project --app cli_xxx:sec_xxx

  # Use only when you must force QR onboarding
  cc-connect feishu new --project my-project --platform-type lark`)
}

func resolveFeishuSetupInputs(mode, app, appID, appSecret string) (effectiveMode, resolvedAppID, resolvedAppSecret string, err error) {
	app = strings.TrimSpace(app)
	appID = strings.TrimSpace(appID)
	appSecret = strings.TrimSpace(appSecret)

	if app != "" && (appID != "" || appSecret != "") {
		return "", "", "", fmt.Errorf("use either --app or --app-id/--app-secret, not both")
	}

	if app != "" {
		appID, appSecret, err = parseAppPair(app)
		if err != nil {
			return "", "", "", err
		}
	}

	if appID != "" || appSecret != "" {
		if appID == "" || appSecret == "" {
			return "", "", "", fmt.Errorf("both --app-id and --app-secret are required")
		}
	}

	effectiveMode = mode
	if mode == feishuSetupModeAuto {
		if appID != "" && appSecret != "" {

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Use only --app id:secret, or only --app-id X --app-secret Y
  2. Remove the redundant --app flag if you intend to use the split flags
  3. Remove --app-id/--app-secret if you intend to use --app

Example fix

// before
cc-connect feishu setup --app id:secret --app-id id --app-secret sec
// after
cc-connect feishu setup --app-id id --app-secret sec
Defensive patterns

Strategy: validation

Validate before calling

if [[ -n "$APP" && ( -n "$APP_ID" || -n "$APP_SECRET" ) ]]; then echo "use --app or --app-id/--app-secret, not both" >&2; exit 1; fi

Prevention

When it happens

Trigger: `cc-connect feishu setup --app id:secret --app-id id` or `--app id:secret --app-secret secret` (also after whitespace trimming).

Common situations: Migrating scripts from one flag style to the other and leaving both behind, or extending an existing command line with a second credential source copied from docs.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


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