chenhg5/cc-connect · critical

%s: app_id and app_secret are required

Error message

%s: app_id and app_secret are required

What it means

Startup validation in newPlatform: the Feishu platform adapter cannot authenticate without app_id and app_secret in its options map, so it refuses to construct. Prevents a platform that would fail on every API call from being registered.

Source

Thrown at platform/feishu/feishu.go:335

type richCardImageUpload struct {
	done chan struct{}
}

type feishuRequestFunc func(client *lark.Client, options ...larkcore.RequestOptionFunc) error

func (p *Platform) SetCardNavigationHandler(h core.CardNavigationHandler) {
	p.cardNavHandler = h
}

func New(opts map[string]any) (core.Platform, error) {
	return newPlatform("feishu", lark.FeishuBaseUrl, opts)
}

func newPlatform(name, domain string, opts map[string]any) (core.Platform, error) {
	appID, _ := opts["app_id"].(string)
	appSecret, _ := opts["app_secret"].(string)
	if appID == "" || appSecret == "" {
		return nil, fmt.Errorf("%s: app_id and app_secret are required", name)
	}
	if v, ok := opts["domain"].(string); ok {
		v = strings.TrimSpace(v)
		if v != "" {
			if _, err := url.ParseRequestURI(v); err != nil {
				return nil, fmt.Errorf("%s: invalid domain %q: %w", name, v, err)
			}
			domain = v
		}
	}
	reactionEmoji, _ := opts["reaction_emoji"].(string)
	if reactionEmoji == "" {
		reactionEmoji = "OnIt"
	}
	if v, ok := opts["reaction_emoji"].(string); ok && v == "none" {
		reactionEmoji = ""
	}
	doneEmoji, _ := opts["done_emoji"].(string)

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Add app_id and app_secret string values to the feishu platform section of config.toml.
  2. Check key spelling: must be exactly app_id and app_secret (snake_case).
  3. Verify the credential source (env var, secrets file) is non-empty at daemon start.
  4. Create an app at open.feishu.cn if you have no credentials yet.

Example fix

// before
[[platform]]
name = "feishu"
// after
[[platform]]
name = "feishu"
[platform.options]
app_id = "cli_xxx"
app_secret = "xxxxx"
Defensive patterns

Strategy: validation

Validate before calling

// pre-start check
if os.Getenv("FEISHU_APP_ID") == "" || os.Getenv("FEISHU_APP_SECRET") == "" {
    log.Fatal("feishu: app_id/app_secret missing from environment")
}

Prevention

When it happens

Trigger: Configuring a [[platform]] block with name="feishu" but omitting app_id or app_secret, or providing them as empty strings / non-string types (e.g. numbers).

Common situations: Fresh setup before credentials were created in the Feishu open platform; env-var interpolation producing empty strings; typo'd keys (appId vs app_id).

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/ed9b17a02fab0bf5. Report an issue: GitHub.