{"record":{"id":"66fcd3948aed31c8","repo":"chenhg5/cc-connect","slug":"config-s-card-mode-must-be-legacy-or-rich","errorCode":null,"errorMessage":"config: %s.card_mode must be \"legacy\" or \"rich\"","messagePattern":"config: (.+?)\\.card_mode must be \"legacy\" or \"rich\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/config.go","lineNumber":1090,"sourceCode":"\treturn nil\n}\n\nfunc validateDisplayConfig(prefix string, display *DisplayConfig) error {\n\tif display == nil {\n\t\treturn nil\n\t}\n\tif display.Mode != nil {\n\t\tswitch *display.Mode {\n\t\tcase DisplayModeFull, DisplayModeCompact, DisplayModeQuiet:\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"config: %s.mode must be \\\"full\\\", \\\"compact\\\", or \\\"quiet\\\"\", prefix)\n\t\t}\n\t}\n\tif display.CardMode != nil {\n\t\tswitch strings.ToLower(strings.TrimSpace(*display.CardMode)) {\n\t\tcase \"legacy\", \"rich\":\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"config: %s.card_mode must be \\\"legacy\\\" or \\\"rich\\\"\", prefix)\n\t\t}\n\t}\n\tif display.HistoryMaxLen != nil && *display.HistoryMaxLen < 0 {\n\t\treturn fmt.Errorf(\"config: %s.history_max_len must be >= 0\", prefix)\n\t}\n\treturn nil\n}\n\nvar supportedReferenceAgents = map[string]struct{}{\n\t\"all\":        {},\n\t\"codex\":      {},\n\t\"claudecode\": {},\n}\n\nvar supportedReferencePlatforms = map[string]struct{}{\n\t\"all\":    {},\n\t\"feishu\": {},\n\t\"weixin\": {},","sourceCodeStart":1072,"sourceCodeEnd":1108,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/config/config.go#L1072-L1108","documentation":"CC-Connect validates each project's card rendering mode at config load time. When `[projects.display].card_mode` is set to anything other than \"legacy\" or \"rich\" (case-insensitive, whitespace-trimmed), validateDisplayConfig rejects the config. It selects between the old and new card renderers.","triggerScenarios":"Loading config.toml where a project's `[projects.*.display] card_mode` is a misspelled or outdated value such as \"card\", \"new\", \"v2\", or \"classic\".","commonSituations":"Following an old blog post or migration guide that used a pre-release name for the rich card mode; typos when hand-editing; confusion with other boolean-ish card toggles.","solutions":["Set card_mode to \"rich\" (new renderer) or \"legacy\" (old renderer)","Fix spelling/typos; values are lowercased and trimmed but must match one of the two words","Delete the card_mode line to use the default"],"exampleFix":"# before\n[projects.display]\ncard_mode = \"v2\"\n\n# after\n[projects.display]\ncard_mode = \"rich\"","handlingStrategy":"validation","validationCode":"cm := strings.ToLower(strings.TrimSpace(cardMode))\nif cm != \"legacy\" && cm != \"rich\" {\n    return fmt.Errorf(\"card_mode %q must be legacy or rich\", cardMode)\n}","typeGuard":"func isValidCardMode(m string) bool { cm := strings.ToLower(strings.TrimSpace(m)); return cm == \"legacy\" || cm == \"rich\" }","tryCatchPattern":null,"preventionTips":["Only use the two documented values: legacy, rich","Treat blog posts about pre-release card modes as outdated","Trim/case doesn't matter here, but spelling does"],"tags":["config","validation","toml"],"backgroundTag":"invalid-enum-value","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}