chenhg5/cc-connect · error

app_id/app_secret are required

Error message

app_id/app_secret are required

What it means

validateAppCredentials trims the supplied app_id and app_secret and fails fast if either is empty, returning this error before attempting any Feishu/Lark API validation. The setup wizard refuses to write an unusable platform config. It is a pure input check, not a network or auth failure.

Source

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

	}
}

func normalizeFeishuPlatformType(raw string) (string, error) {
	raw = strings.ToLower(strings.TrimSpace(raw))
	if raw == "" {
		return "", nil
	}
	if raw != "feishu" && raw != "lark" {
		return "", fmt.Errorf("invalid --platform-type %q, want feishu or lark", raw)
	}
	return raw, nil
}

func validateAppCredentials(appID, appSecret, platformType string) (string, error) {
	appID = strings.TrimSpace(appID)
	appSecret = strings.TrimSpace(appSecret)
	if appID == "" || appSecret == "" {
		return "", errors.New("app_id/app_secret are required")
	}

	candidates := []string{"feishu", "lark"}
	if platformType == "feishu" || platformType == "lark" {
		candidates = []string{platformType}
	}

	var lastErr error
	for _, candidate := range candidates {
		base := openFeishuBaseURL
		if candidate == "lark" {
			base = openLarkBaseURL
		}
		ok, err := validateAppCredentialsAgainstBase(base, appID, appSecret)
		if err != nil {
			lastErr = err
			continue
		}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Obtain app_id and app_secret from the Feishu/Lark Open Platform console for your app
  2. Re-run `cc-connect feishu setup` and paste both values when prompted
  3. If sourcing from env, verify the variables are set: `echo -n "$FEISHU_APP_ID" | wc -c`
  4. Trim stray whitespace/newlines when pasting; the code trims but cannot invent values

Example fix

// before
validateAppCredentials("", "", "feishu") // error
// after
validateAppCredentials("cli_a1b2c3", os.Getenv("FEISHU_APP_SECRET"), "feishu")
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(appID) == "" || strings.TrimSpace(appSecret) == "" {
    return errors.New("app_id/app_secret are required")
}

Type guard

func hasCredentials(appID, appSecret string) bool {
    return strings.TrimSpace(appID) != "" && strings.TrimSpace(appSecret) != ""
}

Prevention

When it happens

Trigger: Running `cc-connect feishu setup` (runFeishuSetup) and answering the app_id or app_secret prompt with empty input, or passing an empty/whitespace-only value programmatically to validateAppCredentials.

Common situations: Developer skipped the credential prompt by pressing Enter, pasted only one of the two values, an env var like FEISHU_APP_SECRET was unset so the shell substituted an empty string, or copied a config template with placeholder credentials removed.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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