{"record":{"id":"e9b98b454a39100d","repo":"temporalio/temporal","slug":"requested-bucket-does-not-exist","errorCode":null,"errorMessage":"requested bucket does not exist","messagePattern":"requested bucket does not exist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/archiver/s3store/history_archiver.go","lineNumber":41,"sourceCode":"\t\"go.temporal.io/server/common/config\"\n\t\"go.temporal.io/server/common/log\"\n\t\"go.temporal.io/server/common/log/tag\"\n\t\"go.temporal.io/server/common/metrics\"\n\t\"go.temporal.io/server/common/persistence\"\n)\n\nconst (\n\t// URIScheme is the scheme for the s3 implementation\n\tURIScheme               = \"s3\"\n\terrEncodeHistory        = \"failed to encode history batches\"\n\terrWriteKey             = \"failed to write history to s3\"\n\tdefaultBlobstoreTimeout = time.Minute\n\ttargetHistoryBlobSize   = 2 * 1024 * 1024 // 2MB\n)\n\nvar (\n\terrNoBucketSpecified = errors.New(\"no bucket specified\")\n\terrBucketNotExists   = errors.New(\"requested bucket does not exist\")\n\terrEmptyAwsRegion    = errors.New(\"empty aws region\")\n\n\t// the retryer is used to check if the error is retryable\n\tawsRetryer aws.Retryer = retry.NewStandard()\n)\n\ntype (\n\thistoryArchiver struct {\n\t\texecutionManager persistence.ExecutionManager\n\t\tlogger           log.Logger\n\t\tmetricsHandler   metrics.Handler\n\t\ts3cli            S3API\n\t\t// only set in test code\n\t\thistoryIterator archiver.HistoryIterator\n\t}\n\n\tgetHistoryToken struct {\n\t\tCloseFailoverVersion int64","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/archiver/s3store/history_archiver.go#L23-L59","documentation":"errBucketNotExists is an unexported sentinel in common/archiver/s3store indicating the S3 bucket referenced by the archival URI does not exist. ValidateURI returns it after a HeadBucket-style BucketExists check; getHighestVersion translates AWS NoSuchBucket errors into it; and Upload/Download surface it when S3 rejects operations on a missing bucket.","triggerScenarios":"historyArchiver.ValidateURI(\"s3://no-such-bucket/x\") when BucketExists gets NoSuchBucket/404; getHighestVersion during Get when ListObjectsV2 returns *types.NoSuchBucket; Upload or Download calls hitting a deleted or never-created bucket during Archive/Get.","commonSituations":"Bucket deleted or renamed after the namespace was configured; typo in bucket name in the archival URI; wrong region — a bucket existing in another region can appear not to exist; IAM credentials lacking s3:ListBucket/HeadBucket so existence checks fail; using an S3-compatible endpoint where the bucket was not pre-created.","solutions":["Create the bucket (aws s3 mb s3://<bucket> --region <region>) or correct the bucket name in the namespace archival URI.","Verify the bucket exists in the configured region and that s3config.Region matches the bucket's region.","Check IAM permissions: the archiver needs HeadBucket/ListBucket as well as Get/PutObject.","If using a custom endpoint (S3-compatible storage), confirm the endpoint URL is correct and the bucket was created there."],"exampleFix":"// before\nuri, _ := archiver.NewURI(\"s3://temporal-archive-old/prod\") // bucket was deleted\nerr := archiver.ValidateURI(uri) // errBucketNotExists\n\n// after\n// recreate or point at an existing bucket\nuri, _ := archiver.NewURI(\"s3://temporal-archive/prod\")\nerr := archiver.ValidateURI(uri) // nil","handlingStrategy":"validation","validationCode":"uri, err := archiver.NewURI(archiveURI)\nif err != nil {\n\treturn err\n}\n// historyArchiver.ValidateURI performs SoftValidateURI + BucketExists\nif err := archiver.ValidateURI(uri); err != nil {\n\treturn fmt.Errorf(\"archival target unusable: %w\", err)\n}","typeGuard":"func isBucketNotExists(err error) bool {\n\treturn errors.Is(err, errBucketNotExists) || strings.Contains(err.Error(), \"does not exist\")\n}","tryCatchPattern":"resp, err := archiverClient.GetHistory(ctx, req)\nif err != nil {\n\tvar invalidArg *serviceerror.InvalidArgument\n\tif errors.As(err, &invalidArg) && strings.Contains(invalidArg.Message, \"bucket does not exist\") {\n\t\t// surface a config-fix hint instead of retrying\n\t\treturn nil, fmt.Errorf(\"check archival bucket %q exists and region/IAM are correct\", bucket)\n\t}\n\treturn nil, err\n}","preventionTips":["Create and verify the bucket before pointing a namespace at it; keep bucket lifetime tied to the namespace config.","Ensure the archiver's region matches the bucket's region — cross-region buckets can appear nonexistent.","Grant IAM permissions for HeadBucket/ListBucket in addition to Get/PutObject.","Call ValidateURI as a startup/health check for archival-enabled namespaces."],"tags":["archival","s3","aws","bucket"],"backgroundTag":"s3-bucket-not-found","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}