{"record":{"id":"56abac66f845e30f","repo":"weaviate/weaviate","slug":"int-greater-than-0-expected-got-v","errorCode":null,"errorMessage":"int greater than 0 expected, got %v","messagePattern":"int greater than 0 expected, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/config/parser/validation.go","lineNumber":39,"sourceCode":"func ValidateFloatGreaterThan0(val float64) error {\n\tif val > 0 {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"float greater than 0 expected, got %v\", val)\n}\n\nfunc ValidateFloatGreaterThanEqual0(val float64) error {\n\tif val >= 0 {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"float greater than equal 0 expected, got %v\", val)\n}\n\nfunc ValidateIntGreaterThan0(val int) error {\n\tif val > 0 {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"int greater than 0 expected, got %v\", val)\n}\n\nfunc ValidateIntGreaterThanEqual0(val int) error {\n\tif val >= 0 {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"int greater than equal 0 expected, got %v\", val)\n}\n\nfunc ValidateDurationGreaterThan0(val time.Duration) error {\n\tif val > 0 {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"duration greater than 0 expected, got %v\", val)\n}\n\nfunc ValidateDurationGreaterThanEqual0(val time.Duration) error {\n\tif val >= 0 {","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/config/parser/validation.go#L21-L57","documentation":"ValidateIntGreaterThan0 in usecases/config/parser/validation.go requires a strictly positive integer and returns this error for 0 or negatives. It is typically consumed via ParseDynamicIntWithValidation, producing messages like \"<ENV_VAR>: int greater than 0 expected, got <v>\".","triggerScenarios":"Setting a count-like env var (workers, ports, limits, shard counts) parsed with this validator to 0 or a negative number, e.g. TRACKED_LIMIT=0.","commonSituations":"Using 0 to mean 'unlimited/auto' when the validator requires >=1; string-to-int coercion of \"\" or \"null\" to 0; miscounted arithmetic in deployment scripts.","solutions":["Set the env var to a positive integer (>= 1)","Unset it to fall back to the validated default","If 0 should mean 'auto', check the setting's docs for a dedicated sentinel value or a GreaterThanEqual0-validated alternative","Quote-check manifests so empty strings don't coerce to 0"],"exampleFix":"// before\nWORKER_COUNT=0\n// after\nWORKER_COUNT=4","handlingStrategy":"validation","validationCode":"func validatePositiveInt(name string) error {\n    v, err := strconv.Atoi(os.Getenv(name))\n    if err != nil || v <= 0 {\n        return fmt.Errorf(\"%s must be an int > 0, got %q\", name, os.Getenv(name))\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use >= 1 for counts (workers, ports, limits) — 0 is not a valid 'auto' here","Quote-check manifests so empty strings don't coerce to 0","Sanity-check computed values in deploy scripts before export","Keep defaults in place by leaving the var unset rather than guessing a value"],"tags":["config","validation","int"],"backgroundTag":"value-must-be-positive","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"}