weaviate/weaviate · error

parse REINDEX_INDEXES_AT_STARTUP as class with props: %w

Error message

parse REINDEX_INDEXES_AT_STARTUP as class with props: %w

What it means

FromEnv parses REINDEX_INDEXES_AT_STARTUP with a class-with-properties parser (format "Class1:prop1,prop2;Class2:prop1"). If the parser (cptParser.parse) fails, the error is wrapped as "parse REINDEX_INDEXES_AT_STARTUP as class with props: %w" and startup aborts, since a malformed value would silently skip required reindexing.

Source

Thrown at usecases/config/environment.go:304

			return err
		}
	}

	if err := parser.ParseDynamicIntWithValidation("EXPORT_PARALLELISM",
		DefaultExportParallelism,
		parser.ValidateIntGreaterThanEqual0,
		func(val *configRuntime.DynamicValue[int]) { config.ExportParallelism = val }); err != nil {
		return err
	}

	cptParser := newCollectionPropsTenantsParser()

	// variable expects string in format:
	// "Class1:property11,property12;Class2:property21,property22"
	if v := os.Getenv("REINDEX_INDEXES_AT_STARTUP"); v != "" {
		cpts, err := cptParser.parse(v)
		if err != nil {
			return fmt.Errorf("parse REINDEX_INDEXES_AT_STARTUP as class with props: %w", err)
		}

		asClassesWithProps := make(map[string][]string, len(cpts))
		for _, cpt := range cpts {
			asClassesWithProps[cpt.Collection] = cpt.Props
		}
		config.ReindexIndexesAtStartup = asClassesWithProps
	}

	if v := os.Getenv("PROMETHEUS_MONITORING_PORT"); v != "" {
		asInt, err := strconv.Atoi(v)
		if err != nil {
			return fmt.Errorf("parse PROMETHEUS_MONITORING_PORT as int: %w", err)
		}

		config.Monitoring.Port = asInt
	}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Reformat the value to "Class1:prop1,prop2;Class2:prop1" exactly, e.g. REINDEX_INDEXES_AT_STARTUP="Article:description,summary".
  2. Unset the variable if no startup reindex is needed.
  3. Check the parser (cptParser) expectations in usecases/config for the accepted grammar before constructing the value programmatically.

Example fix

// before
REINDEX_INDEXES_AT_STARTUP=Article description summary
// after
REINDEX_INDEXES_AT_STARTUP=Article:description,summary
Defensive patterns

Strategy: validation

Validate before calling

v := os.Getenv("REINDEX_INDEXES_AT_STARTUP")
if v != "" {
    for _, part := range strings.Split(v, ";") {
        cls := strings.SplitN(part, ":", 2)
        if len(cls) != 2 || cls[0] == "" || cls[1] == "" {
            return fmt.Errorf("invalid REINDEX_INDEXES_AT_STARTUP segment %q", part)
        }
    }
}

Type guard

func validClassWithProps(v string) bool {
    for _, part := range strings.Split(v, ";") {
        kv := strings.SplitN(part, ":", 2)
        if len(kv) != 2 || kv[0] == "" || kv[1] == "" {
            return false
        }
    }
    return v != ""
}

Prevention

When it happens

Trigger: REINDEX_INDEXES_AT_STARTUP set with syntax the parser rejects: missing colon after a class ("Class1,prop"), empty class or property segment ("Class1:", ":prop"), wrong separator ("Class1:prop1 prop2" or ";" inside a property list), or trailing separators, during LoadConfig.

Common situations: Hand-editing the value and forgetting the Class:props structure; YAML list passed instead of the flat string; case where users list classes only without any property ("MyClass" with no colon/props).

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/1739e55e9c34d4dd. Report an issue: GitHub.