Tencent/WeKnora · error
%s exceeds %d characters
Error message
%s exceeds %d characters
What it means
validatePromptInstructionFields enforces MaxCustomPromptInstructionsLength on every knowledge-base / effective-process prompt instruction field. If any field's rune length exceeds the limit, it fails with "<fieldName> exceeds <limit> characters".
Source
Thrown at internal/types/prompt_instructions.go:85
return validatePromptInstructionFields(fields)
}
// ValidateEffectiveProcessPromptInstructions checks length limits on the
// merged per-upload effective config.
func ValidateEffectiveProcessPromptInstructions(eff EffectiveProcessConfig) error {
fields := map[string]string{
"table metadata instructions": eff.ChunkingConfig.TableMetadataInstructions,
"image instructions": eff.VLMConfig.CustomInstructions,
"question generation instructions": eff.QuestionGenerationConfig.CustomInstructions,
"graph extraction instructions": eff.ExtractConfig.CustomInstructions,
}
return validatePromptInstructionFields(fields)
}
func validatePromptInstructionFields(fields map[string]string) error {
for name, value := range fields {
if len([]rune(value)) > MaxCustomPromptInstructionsLength {
return fmt.Errorf("%s exceeds %d characters", name, MaxCustomPromptInstructionsLength)
}
}
return nil
}
View on GitHub (pinned to 988cbb0330)
Solutions
- Trim the offending field to MaxCustomPromptInstructionsLength runes before validation
- Show the character count in the UI and block submission over the limit
- Split long instructions across multiple fields or use summarization
- Check the constant's current value — if the limit legitimately changed, update stored content or migrate
Example fix
// before
instructions["system"] = veryLongText // > limit
// after
runes := []rune(veryLongText)
if len(runes) > MaxCustomPromptInstructionsLength {
instructions["system"] = string(runes[:MaxCustomPromptInstructionsLength])
} Defensive patterns
Strategy: validation
Validate before calling
func withinLimit(fields map[string]string) bool {
for _, v := range fields {
if len([]rune(v)) > MaxCustomPromptInstructionsLength { return false }
}
return true
} Type guard
func fieldWithinLimit(s string) bool { return len([]rune(s)) <= MaxCustomPromptInstructionsLength } Try / catch
if err := validatePromptInstructionFields(fields); err != nil {
// err text names the offending field, e.g. "system exceeds 2000 characters"
fieldName := strings.SplitN(err.Error(), " ", 2)[0]
// highlight fieldName in the UI
} Prevention
- Enforce a character counter in editors with the same limit and rune counting
- Validate before save/submit, not only server-side
- Watch for limit changes across versions and re-validate stored content after upgrades
When it happens
Trigger: Calling ValidateKnowledgeBasePromptInstructions or ValidateEffectiveProcessPromptInstructions with a map of prompt instruction fields where any value exceeds MaxCustomPromptInstructionsLength runes.
Common situations: Users pasting very long custom instructions into a knowledge-base or process editor, programmatic imports of large prompt templates, or accumulated instruction text growing past the cap across edits.
Related errors
- model ID cannot be empty
- unknown credential field:
- member_limit must be >= 0
- cannot request upgrade to same or lower role
- E2B timeout must be at least one second
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/659d1799e1ca7d09.
Report an issue: GitHub.