{"record":{"id":"6d8c1085a8e1f0b3","repo":"Tencent/WeKnora","slug":"follow-up-max-context-turns-must-be-between-1-and","errorCode":null,"errorMessage":"follow-up max_context_turns must be between 1 and 5","messagePattern":"follow-up max_context_turns must be between 1 and 5","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/types/custom_agent.go","lineNumber":386,"sourceCode":"\t\t\tSuggestionCategoryAction,\n\t\t}\n\t}\n}\n\n// Validate rejects invalid agent-authored suggestion settings before they are\n// persisted or used to incur a model call.\nfunc (c *QuestionSuggestionConfig) Validate() error {\n\tif c == nil {\n\t\treturn nil\n\t}\n\tif c.Starters.Count < 1 || c.Starters.Count > 8 {\n\t\treturn fmt.Errorf(\"starter suggestion count must be between 1 and 8\")\n\t}\n\tif c.FollowUps.Count < 1 || c.FollowUps.Count > 5 {\n\t\treturn fmt.Errorf(\"follow-up suggestion count must be between 1 and 5\")\n\t}\n\tif c.FollowUps.MaxContextTurns < 1 || c.FollowUps.MaxContextTurns > 5 {\n\t\treturn fmt.Errorf(\"follow-up max_context_turns must be between 1 and 5\")\n\t}\n\tif !oneOf(c.Starters.Mode, SuggestionModeCurated, SuggestionModeKnowledge, SuggestionModeHybrid) {\n\t\treturn fmt.Errorf(\"invalid starter suggestion mode %q\", c.Starters.Mode)\n\t}\n\tif !oneOf(c.FollowUps.Mode, SuggestionModeGenerated, SuggestionModeKnowledge, SuggestionModeHybrid) {\n\t\treturn fmt.Errorf(\"invalid follow-up suggestion mode %q\", c.FollowUps.Mode)\n\t}\n\tfor i, item := range c.Starters.Items {\n\t\ttrimmed := strings.TrimSpace(item)\n\t\tif trimmed == \"\" {\n\t\t\treturn fmt.Errorf(\"starter suggestion %d cannot be empty\", i+1)\n\t\t}\n\t\tif len([]rune(trimmed)) > 200 {\n\t\t\treturn fmt.Errorf(\"starter suggestion %d exceeds 200 characters\", i+1)\n\t\t}\n\t}\n\tif len([]rune(strings.TrimSpace(c.FollowUps.AdditionalInstruction))) > 2000 {\n\t\treturn fmt.Errorf(\"follow-up additional_instruction exceeds 2000 characters\")","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/types/custom_agent.go#L368-L404","documentation":"Configuration validation in QuestionSuggestionConfig.Validate: FollowUps.MaxContextTurns is outside 1–5. This setting bounds how many conversation turns may be fed into follow-up generation; out-of-range values are rejected before use so context assembly can never consume an unbounded history.","triggerScenarios":"Thrown at internal/types/custom_agent.go:386 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Clamp MaxContextTurns into 1..5 in Normalize before Validate","Surface a field-specific correction request to the agent author"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}