{"record":{"id":"e0d7965aab61b2e0","repo":"ory/hydra","slug":"the-provided-region-is-not-a-valid-ory-region","errorCode":null,"errorMessage":"the provided region is not a valid Ory region","messagePattern":"the provided region is not a valid Ory region","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"oryx/region/region.go","lineNumber":119,"sourceCode":"// Value implements driver.Valuer. The empty Region writes as \"\".\nfunc (r Region) Value() (driver.Value, error) {\n\treturn string(r), nil\n}\n\n// IsEqual compares two nullable *Region pointers (both nil = equal).\nfunc IsEqual(a, b *Region) bool {\n\tif a == nil && b == nil {\n\t\treturn true\n\t}\n\tif a == nil || b == nil {\n\t\treturn false\n\t}\n\treturn *a == *b\n}\n\n// ErrInvalid is wrapped when a submitted region is not a known value.\n// Use NewErrInvalid for a herodot 400; use errors.Is for chain checks.\nvar ErrInvalid = errors.New(\"the provided region is not a valid Ory region\")\n\n// ErrNotAllowed is wrapped when a valid region is outside the project's\n// home_region constraint.\nvar ErrNotAllowed = errors.New(\"the provided region is not allowed by this project's home region\")\n\n// NewErrInvalid returns a fresh herodot 400 wrapping ErrInvalid.\nfunc NewErrInvalid() error {\n\treturn errors.WithStack(\n\t\therodot.ErrBadRequest().\n\t\t\tWithReason(ErrInvalid.Error()).\n\t\t\tWithDebug(`region must be one of eu-central, asia-northeast, us-east, us-west, eu, asia, us, global`).\n\t\t\tWithWrap(ErrInvalid),\n\t)\n}\n\n// NewErrNotAllowed returns a fresh herodot 400 wrapping ErrNotAllowed.\nfunc NewErrNotAllowed() error {\n\treturn errors.WithStack(","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/ory/hydra/blob/4174065ffb052799890f7480f5360a877a67ffc1/oryx/region/region.go#L101-L137","documentation":"ErrInvalid is the sentinel wrapped when a submitted region string is not a recognized Ory region value. The package offers NewErrInvalid() which wraps it in a herodot 400 for HTTP responses, while errors.Is can be used to detect it in code. It signals input validation failure on a region/home-region field.","triggerScenarios":"Calling region.Validate (or any API accepting a region field) with a string that is not in the known region set — e.g. a typo, empty string, lowercase mismatch, or a region from a different cloud provider's naming scheme.","commonSituations":"Misconfigured project home_region in config files; stale region names after the provider renames/retires a region; user-supplied region values passed through from an API request without validation; hardcoding a region in infrastructure-as-code with a typo.","solutions":["Use a region constant/type from the region package instead of a raw string literal","Validate the region input with region.Validate before persisting or calling APIs","Check the exact accepted region identifiers for the Ory platform version in use and update config","Return NewErrInvalid() in handlers so clients get a proper 400 with the reason"],"exampleFix":"// before\ncfg.Set(\"home_region\", \"us-central\")\n// after\ncfg.Set(\"home_region\", string(region.USCentral)) // use the package's canonical region value","handlingStrategy":"validation","validationCode":"if err := region.Validate(submittedRegion); err != nil {\n\t// reject input before calling further APIs\n}","typeGuard":"func isRegionInvalidErr(err error) bool {\n\treturn errors.Is(err, region.ErrInvalid)\n}","tryCatchPattern":"if err := doSomethingWithRegion(r); err != nil {\n\tif errors.Is(err, region.ErrInvalid) {\n\t\treturn herodot.ErrBadRequest().WithReason(\"unknown region\")\n\t}\n\treturn err\n}","preventionTips":["Use the package's region constants/types, never free-form strings","Validate region input at the API boundary before persisting it","Keep region name lists in sync with the platform version you deploy"],"tags":["go","validation","region","configuration"],"backgroundTag":"invalid-region-value","analyzedSha":"4174065ffb052799890f7480f5360a877a67ffc1","analyzedAt":"2026-09-03T14:52:41.581Z","contentChangedAt":"2026-09-03T14:52:41.581Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}