{"record":{"id":"88becee2bc0190a5","repo":"temporalio/temporal","slug":"field-workflowid-is-empty","errorCode":null,"errorMessage":"field WorkflowId is empty","messagePattern":"field WorkflowId is empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/archiver/util.go","lineNumber":14,"sourceCode":"package archiver\n\nimport (\n\t\"errors\"\n\n\tarchiverspb \"go.temporal.io/server/api/archiver/v1\"\n\t\"go.temporal.io/server/common/log\"\n\t\"go.temporal.io/server/common/log/tag\"\n)\n\nvar (\n\terrEmptyNamespaceID      = errors.New(\"field NamespaceId is empty\")\n\terrEmptyNamespace        = errors.New(\"field Namespace is empty\")\n\terrEmptyWorkflowID       = errors.New(\"field WorkflowId is empty\")\n\terrEmptyRunID            = errors.New(\"field RunId is empty\")\n\terrInvalidPageSize       = errors.New(\"field PageSize should be greater than 0\")\n\terrEmptyWorkflowTypeName = errors.New(\"field WorkflowTypeName is empty\")\n\terrEmptyStartTime        = errors.New(\"field StartTime is empty\")\n\terrEmptyCloseTime        = errors.New(\"field CloseTime is empty\")\n)\n\n// TagLoggerWithArchiveHistoryRequestAndURI tags logger with fields in the archive history request and the URI\nfunc TagLoggerWithArchiveHistoryRequestAndURI(logger log.Logger, request *ArchiveHistoryRequest, URI string) log.Logger {\n\treturn log.With(\n\t\tlogger,\n\t\ttag.ShardID(request.ShardID),\n\t\ttag.ArchivalRequestNamespaceID(request.NamespaceID),\n\t\ttag.ArchivalRequestNamespace(request.Namespace),\n\t\ttag.ArchivalRequestWorkflowID(request.WorkflowID),\n\t\ttag.ArchivalRequestRunID(request.RunID),\n\t\ttag.ArchivalRequestBranchToken(request.BranchToken),\n\t\ttag.ArchivalRequestNextEventID(request.NextEventID),","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/archiver/util.go#L1-L32","documentation":"errEmptyWorkflowID is a sentinel in common/archiver/util.go returned by ValidateHistoryArchiveRequest, ValidateGetRequest, and ValidateVisibilityArchivalRequest when the request's WorkflowId is empty. The workflow ID is the primary key used to locate the archived workflow's history blob.","triggerScenarios":"Calling ValidateHistoryArchiveRequest / ValidateGetRequest with ArchiveHistoryRequest.WorkflowID or GetHistoryRequest.WorkflowID == \"\", or ValidateVisibilityArchivalRequest with VisibilityRecord.GetWorkflowId() == \"\".","commonSituations":"Reconstructing get/archive requests from partial visibility records; reading WorkflowID from a struct field vs proto getter mismatch; custom archival tooling iterating over records where some lack workflow IDs.","solutions":["Populate WorkflowID from the source request/visibility record before calling the validate API.","Fail fast with Validate* at the entry point of your archival code path to catch unset IDs early.","Check the upstream producer (e.g. history archival) to ensure WorkflowId is always stamped into archived records."],"exampleFix":"// before\nreq := &archiver.GetHistoryRequest{NamespaceID: nsID, RunID: rid, PageSize: 100}\nerr := archiver.ValidateGetRequest(req)\n// after\nreq := &archiver.GetHistoryRequest{NamespaceID: nsID, WorkflowID: wid, RunID: rid, PageSize: 100}\nerr := archiver.ValidateGetRequest(req)","handlingStrategy":"validation","validationCode":"func validateWorkflowID(wfID string) error {\n    if wfID == \"\" {\n        return errors.New(\"WorkflowId must be set before archival request\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := archiver.ValidateGetRequest(req); err != nil {\n    if errors.Is(err, archiver.ErrEmptyWorkflowID) {\n        return nil, status.Error(codes.InvalidArgument, \"WorkflowId is required\")\n    }\n    return nil, err\n}","preventionTips":["Populate WorkflowId from the original workflow execution info before archival calls.","Skip records with empty workflow IDs explicitly rather than passing them to validation.","Use Validate* at the entry of archival code paths to surface unset fields early."],"tags":["go","archival","request-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}