chenhg5/cc-connect · error

%s: invalid progress_style %q (want legacy, compact, or card

Error message

%s: invalid progress_style %q (want legacy, compact, or card)

What it means

The optional progress_style option is an enum restricted to "legacy", "compact", or "card" (case/space-insensitive). Any other value makes newPlatform fail fast rather than silently falling back. Empty string maps to legacy.

Source

Thrown at platform/feishu/feishu.go:410

		if mm, ok := mentionMapRaw.(map[string]any); ok {
			mentionMap = make(map[string]string, len(mm))
			for name, id := range mm {
				if idStr, ok := id.(string); ok && idStr != "" {
					mentionMap[name] = idStr
				}
			}
		}
	}

	progressStyle := "legacy"
	if v, ok := opts["progress_style"].(string); ok {
		switch strings.ToLower(strings.TrimSpace(v)) {
		case "", "legacy":
			progressStyle = "legacy"
		case "compact", "card":
			progressStyle = strings.ToLower(strings.TrimSpace(v))
		default:
			return nil, fmt.Errorf("%s: invalid progress_style %q (want legacy, compact, or card)", name, v)
		}
	}
	useInteractiveCard := true
	if v, ok := opts["enable_feishu_card"].(bool); ok {
		useInteractiveCard = v
	}

	imageBatchWindow := defaultImageBatchWindow
	if raw, ok := opts["image_batch_window_ms"]; ok {
		ms, err := coerceMilliseconds(raw)
		if err != nil {
			return nil, fmt.Errorf("%s: invalid image_batch_window_ms %v: %w", name, raw, err)
		}
		if ms < 0 {
			return nil, fmt.Errorf("%s: image_batch_window_ms must be >= 0, got %d", name, ms)
		}
		imageBatchWindow = time.Duration(ms) * time.Millisecond
	}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Set progress_style to one of: legacy, compact, or card.
  2. Remove the progress_style option to get the default (legacy).
  3. Check spelling/extra words; only single-token values are accepted.

Example fix

// before (config.toml)
progress_style = "progressbar"
// after
progress_style = "compact"
Defensive patterns

Strategy: validation

Validate before calling

allowed := map[string]bool{"": true, "legacy": true, "compact": true, "card": true}
if !allowed[strings.ToLower(strings.TrimSpace(cfg.ProgressStyle))] {
    log.Fatalf("invalid progress_style %q", cfg.ProgressStyle)
}

Prevention

When it happens

Trigger: progress_style = "fancy" or "COMPACT CARD" or "progressbar" in the feishu platform options.

Common situations: Users guessing style names from screenshots; older configs using names removed when the option was introduced; typo like "compct".

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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