{"record":{"id":"5d3e6681fa7a0853","repo":"gofiber/fiber","slug":"range-unsatisfiable-range","errorCode":null,"errorMessage":"range: unsatisfiable range","messagePattern":"range: unsatisfiable range","errorType":"http","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"error.go","lineNumber":52,"sourceCode":"\tErrRedirectBackNoFallback = NewError(StatusInternalServerError, \"Referer not found, you have to enter fallback URL for redirection.\")\n)\n\n// Range errors\nvar (\n\t// ErrRangeMalformed is returned for a syntactically invalid Range header,\n\t// which RFC 9110 Section 14.2 allows a server to reject; it carries a\n\t// 400 Bad Request status so propagating it does not surface as a 500.\n\tErrRangeMalformed = NewError(StatusBadRequest, \"range: malformed range header string\")\n\t// ErrRangeUnsupported is returned for a Range header whose range unit is\n\t// not \"bytes\". RFC 9110 Section 14.2 requires an origin server to IGNORE\n\t// a Range header field with a range unit it does not understand, so\n\t// callers receiving this error should serve the full representation\n\t// instead of returning an error response. It still carries a\n\t// 400 Bad Request status as a safety net, so blind propagation does not\n\t// surface as a 500.\n\tErrRangeUnsupported   = NewError(StatusBadRequest, \"range: unsupported range unit\")\n\tErrRangeTooLarge      = NewError(StatusRequestedRangeNotSatisfiable, \"range: too many ranges\")\n\tErrRangeUnsatisfiable = errors.New(\"range: unsatisfiable range\")\n)\n\n// Binder errors\nvar ErrCustomBinderNotFound = errors.New(\"binder: custom binder not found, please be sure to enter the right name\")\n\n// Format errors\nvar (\n\t// ErrNoHandlers is returned when c.Format is called with no arguments.\n\tErrNoHandlers = errors.New(\"format: at least one handler is required, but none were set\")\n)\n\n// gofiber/schema errors\ntype (\n\t// ConversionError Conversion error exposes the internal schema.ConversionError for public use.\n\tConversionError = schema.ConversionError\n\t// UnknownKeyError error exposes the internal schema.UnknownKeyError for public use.\n\tUnknownKeyError = schema.UnknownKeyError\n\t// EmptyFieldError error exposes the internal schema.EmptyFieldError for public use.","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/gofiber/fiber/blob/a105acad6c1e4576a77f01e02973f67e962bb58d/error.go#L34-L70","documentation":"ErrRangeUnsatisfiable is a public sentinel at error.go:52 intended to represent an HTTP Range request whose selected byte ranges cannot be satisfied (the 416 condition). In this fiber/v3 checkout it has no internal callers: the Range parser in DefaultCtx.Range returns its siblings (ErrRangeMalformed, ErrRangeUnsupported, ErrRangeTooLarge) but not this one. It exists as a stable value for callers to return or match against.","triggerScenarios":"A Range: bytes= header whose start offset equals or exceeds the representation size would conventionally map to this sentinel. In the current revision callers see no error from fiber itself; application code that performs its own Range validation must return ErrRangeUnsatisfiable explicitly, and consumers match it with errors.Is.","commonSituations":"Custom static-file or streaming handlers that parse Range headers and need a typed sentinel; version drift where a future revision returns this from DefaultCtx.Range; clients requesting bytes=1000- against a 500-byte body.","solutions":["When serving ranged content yourself, compute the size and return ErrRangeUnsatisfiable (with a 416 response) when no range intersects the body.","Use the typed sibling errors (ErrRangeMalformed, ErrRangeUnsupported) for the corresponding parse failures so blind propagation does not surface as 500.","Match with errors.Is(err, fiber.ErrRangeUnsatisfiable) rather than string comparison so future revisions stay compatible."],"exampleFix":"// before\nif start >= size {\n    return c.Status(fiber.StatusRequestedRangeNotSatisfiable).SendString(\"unsatisfiable\")\n}\n// after\nif start >= size {\n    return fiber.ErrRangeUnsatisfiable\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"// isRangeUnsatisfiable reports whether err signals a 416 condition.\nfunc isRangeUnsatisfiable(err error) bool {\n    return errors.Is(err, fiber.ErrRangeUnsatisfiable)\n}","tryCatchPattern":"ranges, err := c.Range(size)\nif err != nil {\n    if isRangeUnsatisfiable(err) {\n        return c.Status(fiber.StatusRequestedRangeNotSatisfiable).SendString(\"unsatisfiable\")\n    }\n    return err\n}","preventionTips":["Use the typed sibling errors (ErrRangeMalformed, ErrRangeUnsupported) for the corresponding parse failures.","When serving ranged content yourself, return ErrRangeUnsatisfiable for out-of-bounds ranges so callers get a typed value.","Match with errors.Is rather than string comparison so future revisions stay compatible."],"tags":["range","http","sentinel","streaming"],"backgroundTag":null,"analyzedSha":"a105acad6c1e4576a77f01e02973f67e962bb58d","analyzedAt":"2026-08-11T17:33:26.942Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}