{"record":{"id":"1a392d4347195694","repo":"temporalio/temporal","slug":"watch-not-supported","errorCode":null,"errorMessage":"watch not supported","messagePattern":"watch not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"common/persistence/metadata_manager.go","lineNumber":18,"sourceCode":"package persistence\n\nimport (\n\t\"context\"\n\t\"errors\"\n\n\tenumspb \"go.temporal.io/api/enums/v1\"\n\tnamespacepb \"go.temporal.io/api/namespace/v1\"\n\t\"go.temporal.io/api/serviceerror\"\n\tpersistencespb \"go.temporal.io/server/api/persistence/v1\"\n\t\"go.temporal.io/server/common\"\n\t\"go.temporal.io/server/common/log\"\n\t\"go.temporal.io/server/common/persistence/serialization\"\n\t\"go.temporal.io/server/common/primitives\"\n\t\"google.golang.org/protobuf/types/known/durationpb\"\n)\n\nvar ErrWatchNotSupported = errors.New(\"watch not supported\")\n\ntype (\n\n\t// metadataManagerImpl implements MetadataManager based on MetadataStore and Serializer\n\tmetadataManagerImpl struct {\n\t\tserializer  serialization.Serializer\n\t\tpersistence MetadataStore\n\t\tlogger      log.Logger\n\t\tclusterName string\n\t}\n)\n\nvar _ MetadataManager = (*metadataManagerImpl)(nil)\n\n// NewMetadataManagerImpl returns new MetadataManager\nfunc NewMetadataManagerImpl(\n\tpersistence MetadataStore,\n\tserializer serialization.Serializer,","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/persistence/metadata_manager.go#L1-L36","documentation":"ErrWatchNotSupported (common/persistence/metadata_manager.go:18) is returned by metadata managers whose backing store cannot push namespace change notifications. The namespace registry (common/namespace/nsregistry) implements a documented fallback: if the persistence layer returns ErrWatchNotSupported when starting a watch (WatchNamespaces at metadata_manager.go:266), it degrades to polling-based refresh instead of failing startup. Callers should treat it as an expected capability signal, not a fault.","triggerScenarios":"Calling MetadataManager.WatchNamespaces (or namespace registry Start, which calls startWatch) against a store implementation without watch support, e.g. SQL-based metadata stores lacking a change-notification mechanism.","commonSituations":"Running with SQL persistence (MySQL/PostgreSQL) where no watch mechanism exists; swapping the metadata store backend in tests/SetupTest; registry tests TestWatchFallbackToPolling explicitly exercising the fallback.","solutions":["Handle it explicitly: if errors.Is(err, persistence.ErrWatchNotSupported) fall back to polling-based namespace refresh (as nsregistry does)","Verify which metadata store backend your deployment uses and whether it supports watches","If watch behavior is required, switch to a store implementation that supports it"],"exampleFix":"// before\nerr := mgr.WatchNamespaces(ctx, handler) // fails on SQL stores\n// after\nif err := mgr.WatchNamespaces(ctx, handler); err != nil {\n    if errors.Is(err, persistence.ErrWatchNotSupported) {\n        startPollingRefresher() // degrade gracefully\n        return nil\n    }\n    return err\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":"func isWatchNotSupported(err error) bool {\n    return errors.Is(err, persistence.ErrWatchNotSupported)\n}","tryCatchPattern":"err := mgr.WatchNamespaces(ctx, handler)\nif err != nil {\n    if errors.Is(err, persistence.ErrWatchNotSupported) {\n        startPollingRefresher(pollInterval) // supported degraded mode\n        return nil\n    }\n    return err\n}","preventionTips":["Model watch support as a capability flag on the store implementation and check before calling WatchNamespaces","Mirror nsregistry's pattern: errors.Is(ErrWatchNotSupported) -> polling refresher","Never treat this error as fatal in startup code for SQL-backed deployments","Cover the fallback path in tests (see TestWatchFallbackToPolling)"],"tags":["go","persistence","metadata","namespace-registry","capability"],"backgroundTag":"watch-not-supported","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}