weaviate/weaviate · error
invalid args given for %q reindex task
Error message
invalid args given for %q reindex task
What it means
doInvertedReindex expects the args for 'ShardInvertedReindexTask_SpecifiedIndex' to be of type map[string][]string (class name -> property names). If args is non-nil but of any other type, the type assertion fails and this error is returned. It is a defensive type check on reindex task input.
Source
Thrown at adapters/repos/db/migrator.go:1090
errs := errorcompounder.New()
errs.Add(m.doInvertedReindex(ctx, taskNamesWithArgs))
errs.Add(m.doInvertedIndexMissingTextFilterable(ctx, taskNamesWithArgs))
return errs.ToError()
}
func (m *Migrator) doInvertedReindex(ctx context.Context, taskNamesWithArgs map[string]any) error {
tasks := map[string]ShardInvertedReindexTask{}
for name, args := range taskNamesWithArgs {
switch name {
case "ShardInvertedReindexTaskSetToRoaringSet":
tasks[name] = &ShardInvertedReindexTaskSetToRoaringSet{}
case "ShardInvertedReindexTask_SpecifiedIndex":
if args == nil {
return fmt.Errorf("no args given for %q reindex task", name)
}
argsMap, ok := args.(map[string][]string)
if !ok {
return fmt.Errorf("invalid args given for %q reindex task", name)
}
classNamesWithPropertyNames := map[string]map[string]struct{}{}
for class, props := range argsMap {
classNamesWithPropertyNames[class] = map[string]struct{}{}
for _, prop := range props {
classNamesWithPropertyNames[class][prop] = struct{}{}
}
}
tasks[name] = &ShardInvertedReindexTask_SpecifiedIndex{
classNamesWithPropertyNames: classNamesWithPropertyNames,
}
}
}
if len(tasks) == 0 {
return nil
}
View on GitHub (pinned to 75aa4b6d11)
Solutions
- Change the args value to map[string][]string where the key is the class name and the slice lists property names to reindex.
- If the value came from JSON decoding, convert it: iterate map[string]interface{} and assert each value to []interface{} before building the required map.
- Re-run InvertedReindex with the correctly typed args.
Example fix
// before
args := map[string]string{"Article": "description"}
// after
args := map[string][]string{"Article": {"description"}} Defensive patterns
Strategy: type-guard
Validate before calling
args, ok := rawArgs.(map[string][]string)
if !ok {
return fmt.Errorf("specified-index args must be map[string][]string, got %T", rawArgs)
} Type guard
func asClassPropsArgs(v interface{}) (map[string][]string, bool) {
m, ok := v.(map[string][]string)
return m, ok
} Prevention
- Keep args in their typed form (map[string][]string) end-to-end; avoid decoding into interface{} and passing through.
- Add a unit test asserting the arg type expected by doInvertedReindex.
- Document the arg schema next to the task-name constants.
When it happens
Trigger: Calling InvertedReindex with args for the specified-index task typed as something other than map[string][]string — e.g. map[string]string, []string, or a struct.
Common situations: Refactored internal tooling passing the wrong shape; JSON-decoded args decoded into a generic map[string]interface{} and passed through unchanged; mixing up this task's arg format with another task's.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- expected value to be timestamp, got '%s'
- expected value to be string or time.Time, got '%T'
- rangeable prop '%s' docID %d: invalid value length %d, shoul
- analyzing object '%s': %w
- strategy '%s' is not supported for given index type '%d
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/83597e15f726856d.
Report an issue: GitHub.