Reference documentation and code samples for the google-cloud-errors class Google::Cloud::OutOfRangeError.
OutOfRange means operation was attempted past the valid range.
E.g., seeking or reading past end of file.
Unlike InvalidArgument, this error indicates a problem that may
be fixed if the system state changes. For example, a 32-bit file
system will generate InvalidArgument if asked to read at an
offset that is not in the range [0,2^32-1], but it will generate
OutOfRange if asked to read from an offset past the current
file size.
There is a fair bit of overlap between FailedPrecondition and
OutOfRange. We recommend using OutOfRange (the more specific
error) when it applies so that callers who are iterating through
a space can easily look for an OutOfRange error to detect when
they are done.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# google-cloud-errors - Class Google::Cloud::OutOfRangeError (v1.5.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.5.0 (latest)](/ruby/docs/reference/google-cloud-errors/latest/Google-Cloud-OutOfRangeError)\n- [1.4.0](/ruby/docs/reference/google-cloud-errors/1.4.0/Google-Cloud-OutOfRangeError)\n- [1.3.1](/ruby/docs/reference/google-cloud-errors/1.3.1/Google-Cloud-OutOfRangeError)\n- [1.2.0](/ruby/docs/reference/google-cloud-errors/1.2.0/Google-Cloud-OutOfRangeError) \nReference documentation and code samples for the google-cloud-errors class Google::Cloud::OutOfRangeError.\n\nOutOfRange means operation was attempted past the valid range.\nE.g., seeking or reading past end of file.\n\n\nUnlike InvalidArgument, this error indicates a problem that may\nbe fixed if the system state changes. For example, a 32-bit file\nsystem will generate InvalidArgument if asked to read at an\noffset that is not in the range \\[0,2\\^32-1\\], but it will generate\nOutOfRange if asked to read from an offset past the current\nfile size.\n\n\u003cbr /\u003e\n\nThere is a fair bit of overlap between FailedPrecondition and\nOutOfRange. We recommend using OutOfRange (the more specific\nerror) when it applies so that callers who are iterating through\na space can easily look for an OutOfRange error to detect when\nthey are done. \n\nInherits\n--------\n\n- [Google::Cloud::Error](./Google-Cloud-Error)\n\nMethods\n-------\n\n### #code\n\n def code() -\u003e Integer\n\ngRPC error code for OUT_OF_RANGE \n**Returns**\n\n- (Integer)"]]