Tencent/WeKnora · error

follow-up suggestion count must be between 1 and 5

Error message

follow-up suggestion count must be between 1 and 5

What it means

Configuration validation in QuestionSuggestionConfig.Validate: the follow-up suggestion Count is outside the allowed 1–5 range. The tighter cap (versus 8 for starters) reflects per-turn follow-up cost; the config is rejected before persistence to avoid expensive suggestion generation with an invalid count.

Source

Thrown at internal/types/custom_agent.go:383

		c.FollowUps.Categories = []string{
			SuggestionCategoryClarify,
			SuggestionCategoryDeepen,
			SuggestionCategoryAction,
		}
	}
}

// Validate rejects invalid agent-authored suggestion settings before they are
// persisted or used to incur a model call.
func (c *QuestionSuggestionConfig) Validate() error {
	if c == nil {
		return nil
	}
	if c.Starters.Count < 1 || c.Starters.Count > 8 {
		return fmt.Errorf("starter suggestion count must be between 1 and 8")
	}
	if c.FollowUps.Count < 1 || c.FollowUps.Count > 5 {
		return fmt.Errorf("follow-up suggestion count must be between 1 and 5")
	}
	if c.FollowUps.MaxContextTurns < 1 || c.FollowUps.MaxContextTurns > 5 {
		return fmt.Errorf("follow-up max_context_turns must be between 1 and 5")
	}
	if !oneOf(c.Starters.Mode, SuggestionModeCurated, SuggestionModeKnowledge, SuggestionModeHybrid) {
		return fmt.Errorf("invalid starter suggestion mode %q", c.Starters.Mode)
	}
	if !oneOf(c.FollowUps.Mode, SuggestionModeGenerated, SuggestionModeKnowledge, SuggestionModeHybrid) {
		return fmt.Errorf("invalid follow-up suggestion mode %q", c.FollowUps.Mode)
	}
	for i, item := range c.Starters.Items {
		trimmed := strings.TrimSpace(item)
		if trimmed == "" {
			return fmt.Errorf("starter suggestion %d cannot be empty", i+1)
		}
		if len([]rune(trimmed)) > 200 {
			return fmt.Errorf("starter suggestion %d exceeds 200 characters", i+1)
		}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Clamp follow-ups.Count into 1..5 before Validate
  2. Return a field-level error to the authoring agent
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/types/custom_agent.go:383 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/864c01109694aba7. Report an issue: GitHub.