weaviate/weaviate · error
preset %q not known to stopword detector
Error message
preset %q not known to stopword detector
What it means
NewDetectorFromPreset builds a stopword Detector from a named preset by looking the name up in the package-level Presets map. The Presets map contains only "en" (English) and "none" (empty set). If the preset string is anything else, the lookup fails and this error is returned instead of silently producing a detector with no stopwords.
Source
Thrown at adapters/repos/db/inverted/stopwords/detector.go:52
if err != nil {
return nil, errors.Wrap(err, "failed to create new detector from config")
}
d.SetAdditions(config.Additions)
d.SetRemovals(config.Removals)
d.preset = config.Preset
return d, nil
}
func NewDetectorFromPreset(preset string) (*Detector, error) {
var list []string
var ok bool
if preset != "" {
list, ok = Presets[preset]
if !ok {
return nil, errors.Errorf("preset %q not known to stopword detector", preset)
}
}
d := &Detector{
stopwords: map[string]struct{}{},
}
for _, word := range list {
d.stopwords[word] = struct{}{}
}
d.preset = preset
return d, nil
}
func (d *Detector) ReplaceDetectorFromConfig(config models.StopwordConfig) error {
d.Lock()
defer d.Unlock()
View on GitHub (pinned to 75aa4b6d11)
Solutions
- Set preset to "en" for the English stopword list or "none" for no stopwords.
- If custom stopwords are needed, use additions/removals in StopwordConfig with NewDetectorFromConfig instead of an unsupported preset.
- Check for typos and case-sensitivity — the map lookup is exact-match lowercase.
- If a different language's stopwords are required, supply them via the additions field; no built-in preset exists.
Example fix
// before
sm, err := stopwords.NewDetectorFromPreset("english")
// after
sm, err := stopwords.NewDetectorFromPreset(stopwords.EnglishPreset) // "en" Defensive patterns
Strategy: validation
Validate before calling
validPresets := map[string]bool{"en": true, "none": true}
if !validPresets[preset] {
return fmt.Errorf("preset %q not supported; use \"en\" or \"none\"", preset)
} Type guard
func isKnownStopwordPreset(p string) bool { return p == "en" || p == "none" } Prevention
- Only use the exported constants stopwords.EnglishPreset ("en") and stopwords.NoPreset ("none").
- Validate user-supplied schema configs against the known preset list before applying.
- Remember lookups are case-sensitive; lowercase the input first.
When it happens
Trigger: Calling stopwords.NewDetectorFromPreset with a preset name other than "en" or "none", e.g. "english", "EN", "de", or a language code for a language Weaviate does not ship a preset for.
Common situations: A developer configuring invertedIndexConfig stopwords preset in a collection schema typo's the preset name or assumes other language presets exist; a migration from another system passes an Elasticsearch-style language preset name.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- multi-tenancy is not enabled
- not possible to use the cache without compression
- cannot enable multiple quantization methods at the same time
- configured properties don't exist or are not of text or blob
- endpoint cannot be empty
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/2d80c1a6d2cd440a.
Report an issue: GitHub.