chenhg5/cc-connect · error

--app format must be app_id:app_secret

Error message

--app format must be app_id:app_secret

What it means

parseAppPair splits the --app value on the first colon into app_id and app_secret. It throws this error when the string has no colon, starts with a colon (empty id), ends with a colon (empty secret), or when trimming leaves either half empty. Note the secret itself may contain colons; only the first colon splits.

Source

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

			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`")
	}

	return effectiveMode, appID, appSecret, nil
}

func parseAppPair(raw string) (appID, appSecret string, err error) {
	idx := strings.Index(raw, ":")
	if idx <= 0 || idx >= len(raw)-1 {
		return "", "", fmt.Errorf("--app format must be app_id:app_secret")
	}
	appID = strings.TrimSpace(raw[:idx])
	appSecret = strings.TrimSpace(raw[idx+1:])
	if appID == "" || appSecret == "" {
		return "", "", fmt.Errorf("--app format must be app_id:app_secret")
	}
	return appID, appSecret, nil
}

func resolveTargetProject(project string) (string, error) {
	project = strings.TrimSpace(project)
	if project != "" {
		return project, nil
	}
	projects, err := config.ListProjects()
	if err != nil {
		return "", err
	}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Format the value as id:secret, e.g. --app cli_xxx:shcl_xxx
  2. Verify the credential variable contains both halves separated by a colon
  3. Trim stray whitespace/newlines from the variable before passing it

Example fix

// before
cc-connect feishu setup --app "$FEISHU_APP"   # FEISHU_APP="cli_xxx"
// after
cc-connect feishu setup --app "$APP_ID:$APP_SECRET"
Defensive patterns

Strategy: validation

Validate before calling

case "$APP" in *:*) id="${APP%%:*}"; sec="${APP#*:}"; [[ -n "$id" && -n "$sec" ]] || { echo "--app must be id:secret" >&2; exit 1; };; *) echo "--app must be id:secret" >&2; exit 1;; esac

Prevention

When it happens

Trigger: `--app cliabc` (no colon), `--app :secret`, `--app id:`, `--app " "` or `--app id: ` (whitespace-only halves).

Common situations: Fetching only the app id from a store and forgetting the secret, quoting mistakes in shell dropping part of the pair, or a config variable that was never fully populated.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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