chenhg5/cc-connect · error

config: %s.mode must be "full", "compact", or "quiet"

Error message

config: %s.mode must be "full", "compact", or "quiet"

What it means

CC-Connect validates each project's display settings at config load time. When `[projects.display].mode` is set to a string other than "full", "compact", or "quiet", validateDisplayConfig rejects the whole config. The error names the exact TOML path via the prefix (e.g. `config: projects.myapp.display.mode must be ...`).

Source

Thrown at config/config.go:1083

		if err := validateUsersConfig(prefix, proj.Users); err != nil {
			return err
		}
		if err := validateDisplayConfig(prefix+".display", proj.Display); err != nil {
			return err
		}
	}
	return nil
}

func validateDisplayConfig(prefix string, display *DisplayConfig) error {
	if display == nil {
		return nil
	}
	if display.Mode != nil {
		switch *display.Mode {
		case DisplayModeFull, DisplayModeCompact, DisplayModeQuiet:
		default:
			return fmt.Errorf("config: %s.mode must be \"full\", \"compact\", or \"quiet\"", prefix)
		}
	}
	if display.CardMode != nil {
		switch strings.ToLower(strings.TrimSpace(*display.CardMode)) {
		case "legacy", "rich":
		default:
			return fmt.Errorf("config: %s.card_mode must be \"legacy\" or \"rich\"", prefix)
		}
	}
	if display.HistoryMaxLen != nil && *display.HistoryMaxLen < 0 {
		return fmt.Errorf("config: %s.history_max_len must be >= 0", prefix)
	}
	return nil
}

var supportedReferenceAgents = map[string]struct{}{
	"all":        {},
	"codex":      {},

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Set mode to exactly one of "full", "compact", or "quiet" in the project's display section
  2. Check casing: the value must be lowercase exactly; use "quiet", not "Quiet" or "QUIET"
  3. Remove the mode line entirely if you want the default instead of an explicit value

Example fix

# before
[[projects]]
[projects.display]
mode = "minimal"

# after
[[projects]]
[projects.display]
mode = "compact"
Defensive patterns

Strategy: validation

Validate before calling

validModes := map[string]bool{"full": true, "compact": true, "quiet": true}
if cfg.Projects[i].Display != nil && cfg.Projects[i].Display.Mode != nil && !validModes[*cfg.Projects[i].Display.Mode] {
    return fmt.Errorf("project %d: display.mode %q is not one of full|compact|quiet", i, *cfg.Projects[i].Display.Mode)
}

Type guard

func isValidDisplayMode(m string) bool { return m == "full" || m == "compact" || m == "quiet" }

Prevention

When it happens

Trigger: Loading config.toml where a project's `[projects.*.display] mode` value is any string other than the three accepted display modes — e.g. a typo like mode = "minimal", "verbose", or "Full" with wrong casing (mode is compared exactly, not case-insensitively).

Common situations: Copy-pasting display config from docs of another tool; guessing mode names like "silent" instead of "quiet"; hand-editing config after a version change; leaving uppercase or trailing whitespace (this field is not trimmed, unlike card_mode).

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