{"record":{"id":"2d5d8337cacbd1c7","repo":"vitessio/vitess","slug":"must-be-non-negative","errorCode":null,"errorMessage":"must be non-negative","messagePattern":"must be non-negative","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/common/flags.go","lineNumber":50,"sourceCode":"\t// VReplicationExperimentalFlags is a bitmask of experimental features in vreplication.\n\tVReplicationExperimentalFlagOptimizeInserts           = int64(1)\n\tVReplicationExperimentalFlagAllowNoBlobBinlogRowImage = int64(2)\n\tVReplicationExperimentalFlagVPlayerBatching           = int64(4)\n)\n\ntype (\n\tnonNegativeInt64Flag struct {\n\t\tvalue *int64\n\t}\n)\n\nfunc (f nonNegativeInt64Flag) Set(v string) error {\n\tvalue, err := strconv.ParseInt(v, 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif value < 0 {\n\t\treturn errors.New(\"must be non-negative\")\n\t}\n\t*f.value = value\n\treturn nil\n}\n\nfunc (f nonNegativeInt64Flag) String() string {\n\tif f.value == nil {\n\t\treturn \"0\"\n\t}\n\treturn strconv.FormatInt(*f.value, 10)\n}\n\nfunc (f nonNegativeInt64Flag) Type() string {\n\treturn \"int\"\n}\n\nvar (\n\tvreplicationExperimentalFlags   = VReplicationExperimentalFlagOptimizeInserts | VReplicationExperimentalFlagAllowNoBlobBinlogRowImage | VReplicationExperimentalFlagVPlayerBatching","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/common/flags.go#L32-L68","documentation":"A flag registered with nonNegativeInt64Flag rejected a value because parsing succeeded but the integer is negative. vttablet's common flags only accept zero or positive int64 values for these options.","triggerScenarios":"Starting vttablet with a flag backed by nonNegativeInt64Flag set to a negative number (e.g. -heartbeat_interval=-1 or similar non-negative flags in go/vt/vttablet/common/flags.go).","commonSituations":"Config templates with placeholder negatives; operators trying to 'disable' a feature by passing -1 when the correct disable mechanism is different (0 or a boolean flag); automation generating flag values from subtraction.","solutions":["Pass a non-negative integer (0 or greater) for the flag","If you intended to disable the feature, use 0 or the dedicated disable flag instead of a negative value","Fix the config file/script generating the negative value"],"exampleFix":"// before\nvttablet -heartbeat_interval=-5\n// after\nvttablet -heartbeat_interval=0","handlingStrategy":"validation","validationCode":"v, err := strconv.ParseInt(flagValue, 10, 64)\nif err != nil || v < 0 {\n    return fmt.Errorf(\"flag %s must be a non-negative integer\", flagName)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate flag values in deploy scripts before launching vttablet","Never use negative numbers to 'disable' integer flags; use 0 or dedicated booleans","Lint config templates for negative numeric placeholders"],"tags":["vttablet","flags","validation","cli"],"backgroundTag":"invalid-flag-value","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}