chenhg5/cc-connect · error

both --app-id and --app-secret are required

Error message

both --app-id and --app-secret are required

What it means

After resolving the --app pair form, resolveFeishuSetupInputs checks that if either --app-id or --app-secret is present, both are. Supplying only one half would produce an unusable app credential, so the parser rejects it explicitly before mode resolution.

Source

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

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 != "" {
			effectiveMode = feishuSetupModeBind
		} else {
			effectiveMode = feishuSetupModeNew
		}
	}
	if mode == feishuSetupModeBind && (appID == "" || appSecret == "") {
		return "", "", "", fmt.Errorf("bind mode requires credentials: use --app id:secret or --app-id/--app-secret")
	}
	if mode == feishuSetupModeNew && (appID != "" || appSecret != "") {
		return "", "", "", fmt.Errorf("new mode does not accept credentials; use `cc-connect feishu bind`")
	}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Pass both flags together: --app-id X --app-secret Y
  2. Verify the missing half is non-empty in the calling script (echo/printf to check interpolation)
  3. Use the combined form --app id:secret instead

Example fix

// before
cc-connect feishu setup --app-id "$APP_ID"   # APP_SECRET not passed
// after
cc-connect feishu setup --app-id "$APP_ID" --app-secret "$APP_SECRET"
Defensive patterns

Strategy: validation

Validate before calling

if [[ ( -n "$APP_ID" || -n "$APP_SECRET" ) && ( -z "$APP_ID" || -z "$APP_SECRET" ) ]]; then echo "both app-id and app-secret required" >&2; exit 1; fi

Prevention

When it happens

Trigger: `cc-connect feishu setup --app-id cli_xxx` (secret missing) or `--app-secret xxx` (app id missing). Often the other half was expected from env/config but was not picked up by this parser.

Common situations: Secrets kept out of shell history and passed via env vars that this command does not read, copy-paste truncation of the secret, or a script where the second flag failed to interpolate.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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