ent/ent · error
value is greater than the required rune length
Error message
value is greater than the required rune length
What it means
Validator error registered by stringBuilder.MaxRuneLen: the string's rune (character) count exceeds the configured maximum, rejecting Create/Save at runtime. Counts Unicode runes rather than bytes, matching MaxRuneLen's character-oriented semantics.
Source
Thrown at schema/field/field.go:263
// Operation fails if the length of the string is greater than the given value.
func (b *stringBuilder) MaxLen(i int) *stringBuilder {
b.desc.Size = i
b.desc.Validators = append(b.desc.Validators, func(v string) error {
if len(v) > i {
return errors.New("value is greater than the required length")
}
return nil
})
return b
}
// MaxRuneLen adds a rune length validator for this field.
// Operation fails if the rune count of the string is greater than the given value.
func (b *stringBuilder) MaxRuneLen(i int) *stringBuilder {
b.desc.Size = i
b.desc.Validators = append(b.desc.Validators, func(v string) error {
if utf8.RuneCountInString(v) > i {
return errors.New("value is greater than the required rune length")
}
return nil
})
return b
}
// Validate adds a validator for this field. Operation fails if the validation fails.
func (b *stringBuilder) Validate(fn func(string) error) *stringBuilder {
b.desc.Validators = append(b.desc.Validators, fn)
return b
}
// Default sets the default value of the field.
func (b *stringBuilder) Default(s string) *stringBuilder {
b.desc.Default = s
return b
}
View on GitHub (pinned to 69d5d4deb1)
Solutions
- Shorten the value so its character count is within the limit
- Raise the MaxRuneLen bound in the schema if it is too strict
- Use MaxLen instead if byte-length (storage size) is the intended constraint
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at schema/field/field.go:263 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ent/ent@69d5d4deb1 (2026-09-03).
Data as JSON: /api/errors/f86590890923fcf4.
Report an issue: GitHub.