chenhg5/cc-connect · error

telegram: invalid progress_style %q (want legacy, compact, o

Error message

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

What it means

telegram.New() validates the optional 'progress_style' option against an allowlist ("legacy", "compact", "card"; empty/unset keeps the default). Any other value fails construction with this error listing the valid choices.

Source

Thrown at platform/telegram/telegram.go:181

	groupReplyAll, _ := opts["group_reply_all"].(bool)
	shareSessionInChannel, _ := opts["share_session_in_channel"].(bool)
	enableReactions, _ := opts["enable_reactions"].(bool)

	// Default to "compact" so streaming edits work out of the box. Telegram has
	// no rich card UI, so "card" is normalized to "compact". Users can opt out
	// via progress_style = "legacy" to restore the old "send full text once"
	// behavior.
	progressStyle := "compact"
	if v, ok := opts["progress_style"].(string); ok {
		switch strings.ToLower(strings.TrimSpace(v)) {
		case "":
			// keep default
		case "legacy":
			progressStyle = "legacy"
		case "compact", "card":
			progressStyle = "compact"
		default:
			return nil, fmt.Errorf("telegram: invalid progress_style %q (want legacy, compact, or card)", v)
		}
	}

	return &Platform{
		token:                 token,
		allowFrom:             allowFrom,
		groupReplyAll:         groupReplyAll,
		shareSessionInChannel: shareSessionInChannel,
		enableReactions:       enableReactions,
		progressStyle:         progressStyle,
		httpClient:            httpClient,
	}, nil
}

func (p *Platform) Name() string { return "telegram" }

// ProgressStyle reports the streaming-progress style for this platform.
//

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Change progress_style in config to one of: "legacy", "compact", or "card" (lowercase)
  2. Remove the progress_style line entirely to use the default style
  3. Check the README/config.example.toml of your cc-connect version for the accepted values

Example fix

// before
progress_style = "Card"
# after
progress_style = "card"
Defensive patterns

Strategy: validation

Validate before calling

style, _ := opts["progress_style"].(string)
switch style {
case "", "legacy", "compact", "card":
    // ok
default:
    return fmt.Errorf("unsupported progress_style %q", style)
}

Try / catch

p, err := telegram.New(opts)
if err != nil {
    slog.Error("telegram init failed (check progress_style)", "err", err)
    return err
}

Prevention

When it happens

Trigger: Calling telegram.New(opts) with opts["progress_style"] set to a string not in the set {legacy, compact, card} — e.g. "progress", "cards", "Compact" (case-sensitive), or a leftover value from an older config schema.

Common situations: Config written against a different version whose style names differed; typo; capitalization mismatch since the match is case-sensitive; copy-pasting an example from another platform adapter.

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