{"record":{"id":"de21f959b7ecc81e","repo":"ory/hydra","slug":"the-provided-region-is-not-allowed-by-this-project","errorCode":null,"errorMessage":"the provided region is not allowed by this project's home region","messagePattern":"the provided region is not allowed by this project's home region","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"oryx/region/region.go","lineNumber":123,"sourceCode":"\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(\n\t\therodot.ErrBadRequest().\n\t\t\tWithReason(ErrNotAllowed.Error()).\n\t\t\tWithWrap(ErrNotAllowed),\n\t)","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/ory/hydra/blob/4174065ffb052799890f7480f5360a877a67ffc1/oryx/region/region.go#L105-L141","documentation":"ErrNotAllowed is wrapped when a valid, known region is nonetheless outside the project's allowed home_region constraint. NewErrNotAllowed() produces a herodot 400 wrapping this sentinel so errors.Is works on the client side. Unlike ErrInvalid, the region exists — the project just may not use it.","triggerScenarios":"Submitting a known region value (region.Validate passes) but the project is pinned to a different home_region, so the requested region is rejected by the project's constraint check.","commonSituations":"Deploying a workload into a region different from the project's home region; copy-pasting configuration between projects with different home regions; switching a project's region without updating dependent services.","solutions":["Use the project's configured home_region instead of the requested one","Update the project's home_region setting if the new region is genuinely required","Route the request to the project's home region endpoint rather than a local region","Handle errors.Is(err, region.ErrNotAllowed) in clients to surface an actionable message"],"exampleFix":"// before\nclient.WithRegion(region.EUCentral)\n// after\nclient.WithRegion(project.HomeRegion) // respect the project's home_region constraint","handlingStrategy":"try-catch","validationCode":"if region.IsValid(submittedRegion) && submittedRegion != project.HomeRegion {\n\t// region exists but not allowed for this project\n}","typeGuard":"func isRegionNotAllowedErr(err error) bool {\n\treturn errors.Is(err, region.ErrNotAllowed)\n}","tryCatchPattern":"if err := call(reg); err != nil {\n\tif errors.Is(err, region.ErrNotAllowed) {\n\t\treturn fmt.Errorf(\"region %s not allowed; project home region is %s\", reg, project.HomeRegion)\n\t}\n\treturn err\n}","preventionTips":["Always derive the target region from the project's home_region setting","Detect errors.Is(err, region.ErrNotAllowed) and surface an actionable message","Update dependent services when a project's home region changes"],"tags":["go","region","permissions","configuration"],"backgroundTag":"region-not-allowed","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"}