{"record":{"id":"79b0c454e74c9f79","repo":"ent/ent","slug":"value-out-of-range","errorCode":null,"errorMessage":"value out of range","messagePattern":"value out of range","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"schema/field/numeric.go","lineNumber":130,"sourceCode":"\t}}\n}\n\n// intBuilder is the builder for int field.\ntype intBuilder struct {\n\tdesc *Descriptor\n}\n\n// Unique makes the field unique within all vertices of this type.\nfunc (b *intBuilder) Unique() *intBuilder {\n\tb.desc.Unique = true\n\treturn b\n}\n\n// Range adds a range validator for this field where the given value needs to be in the range of [i, j].\nfunc (b *intBuilder) Range(i, j int) *intBuilder {\n\tb.desc.Validators = append(b.desc.Validators, func(v int) error {\n\t\tif v < i || v > j {\n\t\t\treturn errors.New(\"value out of range\")\n\t\t}\n\t\treturn nil\n\t})\n\treturn b\n}\n\n// Min adds a minimum value validator for this field. Operation fails if the validator fails.\nfunc (b *intBuilder) Min(i int) *intBuilder {\n\tb.desc.Validators = append(b.desc.Validators, func(v int) error {\n\t\tif v < i {\n\t\t\treturn errors.New(\"value out of range\")\n\t\t}\n\t\treturn nil\n\t})\n\treturn b\n}\n\n// Max adds a maximum value validator for this field. Operation fails if the validator fails.","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/ent/ent/blob/69d5d4deb19599f129166634e09d33addcf3f2cc/schema/field/numeric.go#L112-L148","documentation":"Runtime validation error returned by the Range validator attached to an integer field via schema/field.Int().Range(i, j): the value being checked falls outside the inclusive bounds [i, j] that the validator closure captured when the schema was defined. It fires at mutation time (or whenever the validator runs), naming the out-of-bounds integer, not the schema definition itself.","triggerScenarios":"Thrown at schema/field/numeric.go:130 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the value that failed and compare it against the Range(i, j) bounds declared on the field in the ent schema","Clamp or reject the input before it reaches the mutation, e.g. validate user input at the API layer using the same bounds","If the bounds are wrong, widen them in the schema definition (e.g. field.Int(\"age\").Range(0, 130)) — note validators are only enforced at runtime, codegen does not apply them"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"69d5d4deb19599f129166634e09d33addcf3f2cc","analyzedAt":"2026-09-03T16:51:39.799Z","contentChangedAt":"2026-09-03T16:51:39.799Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}