temporalio/temporal · error
field Namespace is empty
Error message
field Namespace is empty
What it means
errEmptyNamespace is a sentinel in common/archiver/util.go returned by ValidateHistoryArchiveRequest and ValidateVisibilityArchivalRequest when the request's Namespace (the namespace *name*, distinct from NamespaceId) is empty. Both the ID and the human-readable name are recorded in archived data, so the name is required.
Source
Thrown at common/archiver/util.go:13
package archiver
import (
"errors"
archiverspb "go.temporal.io/server/api/archiver/v1"
"go.temporal.io/server/common/log"
"go.temporal.io/server/common/log/tag"
)
var (
errEmptyNamespaceID = errors.New("field NamespaceId is empty")
errEmptyNamespace = errors.New("field Namespace is empty")
errEmptyWorkflowID = errors.New("field WorkflowId is empty")
errEmptyRunID = errors.New("field RunId is empty")
errInvalidPageSize = errors.New("field PageSize should be greater than 0")
errEmptyWorkflowTypeName = errors.New("field WorkflowTypeName is empty")
errEmptyStartTime = errors.New("field StartTime is empty")
errEmptyCloseTime = errors.New("field CloseTime is empty")
)
// TagLoggerWithArchiveHistoryRequestAndURI tags logger with fields in the archive history request and the URI
func TagLoggerWithArchiveHistoryRequestAndURI(logger log.Logger, request *ArchiveHistoryRequest, URI string) log.Logger {
return log.With(
logger,
tag.ShardID(request.ShardID),
tag.ArchivalRequestNamespaceID(request.NamespaceID),
tag.ArchivalRequestNamespace(request.Namespace),
tag.ArchivalRequestWorkflowID(request.WorkflowID),
tag.ArchivalRequestRunID(request.RunID),
tag.ArchivalRequestBranchToken(request.BranchToken),View on GitHub (pinned to bde624efd1)
Solutions
- Set the Namespace field to the namespace name alongside NamespaceID before validation.
- Resolve the name from the namespace registry/cache if only the ID is available at the call site.
- Add an upstream check that both NamespaceID and Namespace are non-empty when constructing archival requests.
Example fix
// before
rec := &archiverspb.VisibilityRecord{NamespaceId: nsID, WorkflowId: wid, RunId: rid}
err := archiver.ValidateVisibilityArchivalRequest(rec)
// after
rec := &archiverspb.VisibilityRecord{NamespaceId: nsID, Namespace: nsName, WorkflowId: wid, RunId: rid}
err := archiver.ValidateVisibilityArchivalRequest(rec) Defensive patterns
Strategy: validation
Validate before calling
func validateNamespacePair(nsID, ns string) error {
if nsID == "" || ns == "" {
return errors.New("both NamespaceId and Namespace must be set")
}
return nil
} Try / catch
if err := archiver.ValidateVisibilityArchivalRequest(rec); err != nil {
if errors.Is(err, archiver.ErrEmptyNamespace) {
return nil, status.Error(codes.InvalidArgument, "Namespace (name) is required")
}
return nil, err
} Prevention
- Set both NamespaceId and Namespace together; never copy only one.
- Resolve namespace name from the registry/cache before archival calls.
- Handle deleted/renamed namespaces by failing early with a clear error.
When it happens
Trigger: Calling ValidateHistoryArchiveRequest with ArchiveHistoryRequest.Namespace == "" or ValidateVisibilityArchivalRequest with VisibilityRecord.GetNamespace() == ""; typical when a caller sets NamespaceID but forgets Namespace.
Common situations: Custom archiver implementations building VisibilityRecord protos by hand; migration code that populates only the new ID-style field; namespace name lookup returning empty after namespace was deleted or renamed.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- field NamespaceId is empty
- field WorkflowId is empty
- WorkflowId or WorkflowType is required in query
- only one of WorkflowId or WorkflowType can be specified in a
- only one of StartTime or CloseTime can be specified in a que
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/c0bb67b74e06cfa7.
Report an issue: GitHub.