{"record":{"id":"1739e55e9c34d4dd","repo":"weaviate/weaviate","slug":"parse-reindex-indexes-at-startup-as-class-with-pro","errorCode":null,"errorMessage":"parse REINDEX_INDEXES_AT_STARTUP as class with props: %w","messagePattern":"parse REINDEX_INDEXES_AT_STARTUP as class with props: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/config/environment.go","lineNumber":304,"sourceCode":"\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := parser.ParseDynamicIntWithValidation(\"EXPORT_PARALLELISM\",\n\t\tDefaultExportParallelism,\n\t\tparser.ValidateIntGreaterThanEqual0,\n\t\tfunc(val *configRuntime.DynamicValue[int]) { config.ExportParallelism = val }); err != nil {\n\t\treturn err\n\t}\n\n\tcptParser := newCollectionPropsTenantsParser()\n\n\t// variable expects string in format:\n\t// \"Class1:property11,property12;Class2:property21,property22\"\n\tif v := os.Getenv(\"REINDEX_INDEXES_AT_STARTUP\"); v != \"\" {\n\t\tcpts, err := cptParser.parse(v)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"parse REINDEX_INDEXES_AT_STARTUP as class with props: %w\", err)\n\t\t}\n\n\t\tasClassesWithProps := make(map[string][]string, len(cpts))\n\t\tfor _, cpt := range cpts {\n\t\t\tasClassesWithProps[cpt.Collection] = cpt.Props\n\t\t}\n\t\tconfig.ReindexIndexesAtStartup = asClassesWithProps\n\t}\n\n\tif v := os.Getenv(\"PROMETHEUS_MONITORING_PORT\"); v != \"\" {\n\t\tasInt, err := strconv.Atoi(v)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"parse PROMETHEUS_MONITORING_PORT as int: %w\", err)\n\t\t}\n\n\t\tconfig.Monitoring.Port = asInt\n\t}\n","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/config/environment.go#L286-L322","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Reformat the value to \"Class1:prop1,prop2;Class2:prop1\" exactly, e.g. REINDEX_INDEXES_AT_STARTUP=\"Article:description,summary\".","Unset the variable if no startup reindex is needed.","Check the parser (cptParser) expectations in usecases/config for the accepted grammar before constructing the value programmatically."],"exampleFix":"// before\nREINDEX_INDEXES_AT_STARTUP=Article description summary\n// after\nREINDEX_INDEXES_AT_STARTUP=Article:description,summary","handlingStrategy":"validation","validationCode":"v := os.Getenv(\"REINDEX_INDEXES_AT_STARTUP\")\nif v != \"\" {\n    for _, part := range strings.Split(v, \";\") {\n        cls := strings.SplitN(part, \":\", 2)\n        if len(cls) != 2 || cls[0] == \"\" || cls[1] == \"\" {\n            return fmt.Errorf(\"invalid REINDEX_INDEXES_AT_STARTUP segment %q\", part)\n        }\n    }\n}","typeGuard":"func validClassWithProps(v string) bool {\n    for _, part := range strings.Split(v, \";\") {\n        kv := strings.SplitN(part, \":\", 2)\n        if len(kv) != 2 || kv[0] == \"\" || kv[1] == \"\" {\n            return false\n        }\n    }\n    return v != \"\"\n}","tryCatchPattern":null,"preventionTips":["Always use the exact format \"Class1:prop1,prop2;Class2:prop1\" — class, colon, comma-separated props, semicolon between classes.","Generate the value programmatically from a typed list instead of hand-editing it.","Test startup reindex values on a staging instance before production rollout."],"tags":["configuration","env-var","parse-error","reindex"],"backgroundTag":"invalid-env-var-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"}