{"record":{"id":"32d821bc5459a825","repo":"chenhg5/cc-connect","slug":"config-s-history-max-len-must-be-0","errorCode":null,"errorMessage":"config: %s.history_max_len must be >= 0","messagePattern":"config: (.+?)\\.history_max_len must be >= 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/config.go","lineNumber":1094,"sourceCode":"\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\": {},\n}\n\nvar supportedReferenceDisplayPaths = map[string]struct{}{\n\t\"\":                 {},","sourceCodeStart":1076,"sourceCodeEnd":1112,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/config/config.go#L1076-L1112","documentation":"CC-Connect validates that the display history cap is non-negative at config load time. If `[projects.display].history_max_len` is a negative integer, validateDisplayConfig rejects the config. The value bounds how many history entries are retained/rendered; 0 means unlimited.","triggerScenarios":"Loading config.toml with history_max_len set to a negative number, e.g. history_max_len = -1, typically from a misunderstanding that -1 means 'unlimited'.","commonSituations":"Users porting conventions from other tools where -1 means infinity; sign typo while editing; template configs where a placeholder like -1 was left in.","solutions":["Set history_max_len to 0 for unlimited history (it is not a signed sentinel)","Use a positive integer to cap history entries (e.g. 50)","Remove the line to fall back to the default"],"exampleFix":"# before\n[projects.display]\nhistory_max_len = -1\n\n# after\n[projects.display]\nhistory_max_len = 0","handlingStrategy":"validation","validationCode":"if cfg.Projects[i].Display != nil && cfg.Projects[i].Display.HistoryMaxLen != nil && *cfg.Projects[i].Display.HistoryMaxLen < 0 {\n    return fmt.Errorf(\"history_max_len must be >= 0\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use 0 (not -1) for unlimited history","Never copy -1 sentinel conventions from other tools","Sanity-check all numeric display fields are non-negative before deploying"],"tags":["config","validation","range"],"backgroundTag":"value-out-of-range","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}