{"record":{"id":"2d80c1a6d2cd440a","repo":"weaviate/weaviate","slug":"preset-q-not-known-to-stopword-detector","errorCode":null,"errorMessage":"preset %q not known to stopword detector","messagePattern":"preset %q not known to stopword detector","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/inverted/stopwords/detector.go","lineNumber":52,"sourceCode":"\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create new detector from config\")\n\t}\n\n\td.SetAdditions(config.Additions)\n\td.SetRemovals(config.Removals)\n\td.preset = config.Preset\n\n\treturn d, nil\n}\n\nfunc NewDetectorFromPreset(preset string) (*Detector, error) {\n\tvar list []string\n\tvar ok bool\n\n\tif preset != \"\" {\n\t\tlist, ok = Presets[preset]\n\t\tif !ok {\n\t\t\treturn nil, errors.Errorf(\"preset %q not known to stopword detector\", preset)\n\t\t}\n\t}\n\n\td := &Detector{\n\t\tstopwords: map[string]struct{}{},\n\t}\n\n\tfor _, word := range list {\n\t\td.stopwords[word] = struct{}{}\n\t}\n\td.preset = preset\n\treturn d, nil\n}\n\nfunc (d *Detector) ReplaceDetectorFromConfig(config models.StopwordConfig) error {\n\td.Lock()\n\tdefer d.Unlock()\n","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/inverted/stopwords/detector.go#L34-L70","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nsm, err := stopwords.NewDetectorFromPreset(\"english\")\n// after\nsm, err := stopwords.NewDetectorFromPreset(stopwords.EnglishPreset) // \"en\"","handlingStrategy":"validation","validationCode":"validPresets := map[string]bool{\"en\": true, \"none\": true}\nif !validPresets[preset] {\n    return fmt.Errorf(\"preset %q not supported; use \\\"en\\\" or \\\"none\\\"\", preset)\n}","typeGuard":"func isKnownStopwordPreset(p string) bool { return p == \"en\" || p == \"none\" }","tryCatchPattern":null,"preventionTips":["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."],"tags":["stopwords","configuration","schema"],"backgroundTag":"invalid-enum-value","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}