{"record":{"id":"f0e24419c9a6bbd8","repo":"serverless/serverless","slug":"the-bucket-bucketname-does-not-exist-please","errorCode":null,"errorMessage":"The bucket \"${bucketName}\" does not exist. Please check the bucket name and try again.","messagePattern":"The bucket \"(.+?)\" does not exist\\. Please check the bucket name and try again\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/engine/src/lib/aws/s3.js","lineNumber":93,"sourceCode":"        versioningParams,\n      )\n      const versioningResponse = await this.client.send(getVersioningCommand)\n\n      // Check if versioning is enabled\n      const versioningStatus = versioningResponse.Status\n\n      if (versioningStatus === BucketVersioningStatus.Enabled) {\n        return true\n      } else if (versioningStatus === BucketVersioningStatus.Suspended) {\n        return false\n      } else {\n        return false\n      }\n    } catch (err) {\n      const name = err.name\n      // Check if the error is due to the bucket not existing\n      if (err instanceof NoSuchBucket || name === 'NoSuchBucket') {\n        throw new Error(\n          `The bucket \"${bucketName}\" does not exist. Please check the bucket name and try again.`,\n        )\n      } else {\n        // Re-throw any other errors\n        throw new Error(\n          `An error occurred while checking versioning for bucket \"${bucketName}\": ${err.message}`,\n        )\n      }\n    }\n  }\n\n  /**\n   * Checks if an S3 bucket exists.\n   *\n   * @param {Object} params - The parameters for checking if the bucket exists.\n   * @param {string} params.bucketName - The name of the S3 bucket.\n   * @returns {Promise<boolean>} - Returns true if the bucket exists, false otherwise.\n   */","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/serverless/serverless/blob/b9d7ea51c8cce57cff1207964b9b71123673081f/packages/engine/src/lib/aws/s3.js#L75-L111","documentation":"Thrown by checkBucketVersioning() when the underlying GetBucketVersioningCommand call fails with NoSuchBucket. The method catches the AWS error and re-throws a plain Error (not ServerlessError, no error code) whose message states the bucket does not exist. Because it is a plain Error, callers cannot match on .code and must inspect the message.","triggerScenarios":"GetBucketVersioningCommand rejects with err.name === 'NoSuchBucket' (or an instance of NoSuchBucket) for the supplied bucketName.","commonSituations":"Wrong bucket name (typo); bucket lives in a different AWS account than the credentials in use; bucket was deleted; bucket name correct but the deploy target region differs (S3 names are globally unique but access is account-scoped); credentials point to the wrong account.","solutions":["Verify the bucket name spelling and that it exists in the AWS account the engine is authenticated to.","Run aws s3api list-buckets (or check the console) with the same credentials to confirm ownership.","Call checkIfBucketExists({ bucketName }) before calling checkBucketVersioning to fail fast with a clear signal.","Confirm the bucket has not been deleted and that the region matches."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const exists = await s3.checkIfBucketExists({ bucketName })\nif (!exists) throw new Error(`Bucket ${bucketName} not found; fix the name/region/account`)\n// only then:\nawait s3.checkBucketVersioning({ bucketName })","typeGuard":"// Plain Error with no .code — match on message.\nfunction isBucketNotFound(e) {\n  return e instanceof Error && /does not exist/.test(e.message)\n}","tryCatchPattern":"try {\n  return await s3.checkBucketVersioning({ bucketName })\n} catch (e) {\n  if (isBucketNotFound(e)) { /* bucket missing: fix name/region/account */ }\n  throw e\n}","preventionTips":["Call checkIfBucketExists before any bucket-property read to fail fast with intent.","Keep bucket names in config rather than computing them ad hoc to avoid typos.","Confirm the deploy credentials own the bucket."],"tags":["aws","s3","versioning","bucket-not-found"],"backgroundTag":null,"analyzedSha":"b9d7ea51c8cce57cff1207964b9b71123673081f","analyzedAt":"2026-08-13T04:14:40.386Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}