temporalio/temporal · error
Unknown DC redirection policy
Error message
Unknown DC redirection policy %v
What it means
RedirectionPolicyGenerator constructs the DC (datacenter) redirection policy indicated by policy.Policy. It panics on any policy value other than Noop, AllAPIsForwarding, or SelectedAPIsForwarding, since there is no defined behavior for unknown policies.
Solutions
- Use a supported policy: DCRedirectionPolicyNoop, DCRedirectionPolicyAllAPIsForwarding, or DCRedirectionPolicySelectedAPIsForwarding
- Fix the dynamic config/cluster metadata supplying the unknown policy value
- Upgrade the binary so it recognizes the newer policy enum
Example fix
// before
policy := dcRedirectionPolicy{Policy: 99}
generator := rpc.NewRedirection(policy, ...)
// after
policy := dcRedirectionPolicy{Policy: enumspb.DCRedirectionPolicyNoop}
generator := rpc.NewRedirection(policy, ...) Defensive patterns
Strategy: validation
Validate before calling
switch policy.Policy {
case enumspb.DCRedirectionPolicyNoop,
enumspb.DCRedirectionPolicyAllAPIsForwarding,
enumspb.DCRedirectionPolicySelectedAPIsForwarding:
// ok
default:
return fmt.Errorf("unsupported DC redirection policy %v", policy.Policy)
} Try / catch
func() (p rpc.RedirectionPolicy) {
defer func() {
if recover() != nil { p = rpc.NewNoopRedirectionPolicy(clusterName) }
}()
return generator()
}() Prevention
- Only configure known policy enum values in dynamic config
- Align client/server versions before introducing new policy enums
- Fail fast at config load with a clear message for unknown policies
When it happens
Trigger: Calling NewRedirection with a DCRedirectionPolicy whose Policy field holds an invalid/unregistered enum value — e.g. after adding a new policy enum on the client without updating this generator, or a corrupt/mistyped dynamic config value.
Common situations: Version skew: newer cluster config sets a policy enum an older binary does not know; typo in config mapping to an undefined policy value.
Related errors
- unable to decode cassandra serial consistency
- ActivityTaskScheduledEventAttributes.ActivityID is not set
- And requires at least 2 predicates, got
- Can not append slice to existing list of slices, incoming…
- Can't deep copy non-zero time.Time
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/f42c9873b745823e.
Report an issue: GitHub.
Appendix: source
Thrown at common/rpc/interceptor/dc_redirection_policy.go:106
enabledForNS dynamicconfig.BoolPropertyFnWithNamespaceFilter,
selectedAPIsOnlyForNS dynamicconfig.BoolPropertyFnWithNamespaceFilter,
namespaceRegistry namespace.Registry,
policy config.DCRedirectionPolicy,
) DCRedirectionPolicy {
switch policy.Policy {
case DCRedirectionPolicyDefault:
// default policy, noop
return NewNoopRedirectionPolicy(clusterMetadata.GetCurrentClusterName())
case DCRedirectionPolicyNoop:
return NewNoopRedirectionPolicy(clusterMetadata.GetCurrentClusterName())
case DCRedirectionPolicySelectedAPIsForwarding:
currentClusterName := clusterMetadata.GetCurrentClusterName()
return NewSelectedAPIsForwardingPolicy(currentClusterName, enabledForNS, selectedAPIsOnlyForNS, namespaceRegistry)
case DCRedirectionPolicyAllAPIsForwarding:
currentClusterName := clusterMetadata.GetCurrentClusterName()
return NewAllAPIsForwardingPolicy(currentClusterName, enabledForNS, selectedAPIsOnlyForNS, namespaceRegistry)
default:
panic(fmt.Sprintf("Unknown DC redirection policy %v", policy.Policy))
}
}
// NewNoopRedirectionPolicy is DC redirection policy which does nothing
func NewNoopRedirectionPolicy(currentClusterName string) *NoopRedirectionPolicy {
return &NoopRedirectionPolicy{
currentClusterName: currentClusterName,
}
}
// WithNamespaceIDRedirect redirect the API call based on namespace ID
func (policy *NoopRedirectionPolicy) WithNamespaceIDRedirect(_ context.Context, _ namespace.ID, _ string, _ any, call func(string) error) error {
return call(policy.currentClusterName)
}
// WithNamespaceRedirect redirect the API call based on namespace name
func (policy *NoopRedirectionPolicy) WithNamespaceRedirect(_ context.Context, _ namespace.Name, _ string, _ any, call func(string) error) error {
return call(policy.currentClusterName)View on GitHub (pinned to bde624efd1)