{"record":{"id":"8790783d962778c3","repo":"temporalio/temporal","slug":"dynamic-namespace-archival-state-err","errorCode":null,"errorMessage":"<dynamic namespace archival state err>","messagePattern":"<dynamic namespace archival state err>","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"common/archiver/archival_metadata.go","lineNumber":116,"sourceCode":"func (metadata *archivalMetadata) GetVisibilityConfig() ArchivalConfig {\n\treturn metadata.visibilityConfig\n}\n\n// NewArchivalConfig constructs a new valid ArchivalConfig\nfunc NewArchivalConfig(\n\tstaticClusterStateStr string,\n\tdynamicClusterState dynamicconfig.StringPropertyFn,\n\tenableRead dynamicconfig.BoolPropertyFn,\n\tnamespaceDefaultStateStr string,\n\tnamespaceDefaultURI string,\n) ArchivalConfig {\n\tstaticClusterState, err := getClusterArchivalState(staticClusterStateStr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tnamespaceDefaultState, err := getNamespaceArchivalState(namespaceDefaultStateStr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn &archivalConfig{\n\t\tstaticClusterState:    staticClusterState,\n\t\tdynamicClusterState:   dynamicClusterState,\n\t\tenableRead:            enableRead,\n\t\tnamespaceDefaultState: namespaceDefaultState,\n\t\tnamespaceDefaultURI:   namespaceDefaultURI,\n\t}\n}\n\n// NewDisabledArchvialConfig returns an ArchivalConfig where archival is disabled for both the cluster and the namespace\nfunc NewDisabledArchvialConfig() ArchivalConfig {\n\treturn &archivalConfig{\n\t\tstaticClusterState:    ArchivalDisabled,\n\t\tdynamicClusterState:   nil,\n\t\tenableRead:            nil,\n\t\tnamespaceDefaultState: enumspb.ARCHIVAL_STATE_DISABLED,","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/archiver/archival_metadata.go#L98-L134","documentation":"The sibling of the cluster-state panic: NewArchivalConfig in common/archiver/archival_metadata.go calls getNamespaceArchivalState on the namespaceDefaultStateStr and panics if it cannot be parsed. The thrown value \"<dynamic namespace archival state err>\" wraps the parser's error. Same fail-fast philosophy — invalid namespace default archival state at construction time is fatal.","triggerScenarios":"Calling NewArchivalConfig (directly or via NewArchivalMetadata) with a namespaceDefaultURI/state string that getNamespaceArchivalState rejects — i.e. a default namespace archival state string outside the accepted set.","commonSituations":"Misconfigured namespace default archival state in dynamicconfig or static config (typo like \"Enabled\"); copy-pasted config between clusters where one uses a different state vocabulary; tests such as TestRegisterNamespace_* passing malformed fixture strings.","solutions":["Correct the namespace default archival state string to a valid value (enabled/disabled/paused)","Inspect the wrapped error for the exact offending value","Add pre-start config validation covering both cluster and namespace archival states","In tests, derive state strings from the package's exported constants instead of literals"],"exampleFix":"// before\narchivalConfig := archiver.NewArchivalConfig(\n    dynamicArchivalStatus, config.StaticArchivalStatus, \"defaultEnabled\", uri)\n// after\narchivalConfig := archiver.NewArchivalConfig(\n    dynamicArchivalStatus, config.StaticArchivalStatus, \"enabled\", uri)\n","handlingStrategy":"validation","validationCode":"if !validArchivalState(namespaceDefaultStateStr) {\n    return fmt.Errorf(\"invalid namespace default archival state: %q\", namespaceDefaultStateStr)\n}","typeGuard":"func validNamespaceArchivalState(s string) bool {\n    switch s {\n    case \"\", \"enabled\", \"disabled\", \"paused\":\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Derive namespace default state from constants, not string literals","Validate both cluster and namespace archival states in the same pre-start config check","Share one config-parsing helper between clusters so both fields are validated identically"],"tags":["archival","config","panic","namespace"],"backgroundTag":"invalid-archival-state-config","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}