{"record":{"id":"549f386c63b7d01a","repo":"dutchcoders/transfer.sh","slug":"bucket-not-set","errorCode":null,"errorMessage":"bucket not set.","messagePattern":"bucket not set\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cmd.go","lineNumber":492,"sourceCode":"\t\t}\n\n\t\tif ipBlacklist := c.String(\"ip-blacklist\"); ipBlacklist != \"\" {\n\t\t\tapplyIPFilter = true\n\t\t\tipFilterOptions.BlockedIPs = strings.Split(ipBlacklist, \",\")\n\t\t}\n\n\t\tif applyIPFilter {\n\t\t\toptions = append(options, server.FilterOptions(ipFilterOptions))\n\t\t}\n\n\t\tswitch provider := c.String(\"provider\"); provider {\n\t\tcase \"s3\":\n\t\t\tif accessKey := c.String(\"aws-access-key\"); accessKey == \"\" {\n\t\t\t\treturn errors.New(\"access-key not set.\")\n\t\t\t} else if secretKey := c.String(\"aws-secret-key\"); secretKey == \"\" {\n\t\t\t\treturn errors.New(\"secret-key not set.\")\n\t\t\t} else if bucket := c.String(\"bucket\"); bucket == \"\" {\n\t\t\t\treturn errors.New(\"bucket not set.\")\n\t\t\t} else if store, err := storage.NewS3Storage(c.Context, accessKey, secretKey, bucket, purgeDays, c.String(\"s3-region\"), c.String(\"s3-endpoint\"), c.Bool(\"s3-no-multipart\"), c.Bool(\"s3-path-style\"), logger); err != nil {\n\t\t\t\treturn err\n\t\t\t} else {\n\t\t\t\toptions = append(options, server.UseStorage(store))\n\t\t\t}\n\t\tcase \"gdrive\":\n\t\t\tchunkSize := c.Int(\"gdrive-chunk-size\") * 1024 * 1024\n\n\t\t\tif clientJSONFilepath := c.String(\"gdrive-client-json-filepath\"); clientJSONFilepath == \"\" {\n\t\t\t\treturn errors.New(\"gdrive-client-json-filepath not set.\")\n\t\t\t} else if localConfigPath := c.String(\"gdrive-local-config-path\"); localConfigPath == \"\" {\n\t\t\t\treturn errors.New(\"gdrive-local-config-path not set.\")\n\t\t\t} else if basedir := c.String(\"basedir\"); basedir == \"\" {\n\t\t\t\treturn errors.New(\"basedir not set.\")\n\t\t\t} else if store, err := storage.NewGDriveStorage(c.Context, clientJSONFilepath, localConfigPath, basedir, chunkSize, logger); err != nil {\n\t\t\t\treturn err\n\t\t\t} else {\n\t\t\t\toptions = append(options, server.UseStorage(store))","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/dutchcoders/transfer.sh/blob/c37bfd95797fd6da8a6da53fc13d191994b3f687/cmd/cmd.go#L474-L510","documentation":"Thrown by the transfer.sh CLI when --provider s3 is selected and both AWS keys are present but --bucket is empty. The bucket names the S3 destination for uploaded files; without it the storage backend has no target, so the CLI refuses to start. It is the last of the three mandatory S3 flag checks before NewS3Storage is called.","triggerScenarios":"Running with --provider s3 and both key flags but no --bucket; also a bucket value of \"\" from an unset env interpolation (e.g. --bucket \"$S3_BUCKET\" with the variable empty).","commonSituations":"Multi-environment deployments where the bucket differs per env and the staging value was never set; renamed/deleted buckets whose references were removed from config; copy-pasting a minimal s3 example that only includes credentials.","solutions":["Add --bucket <your-bucket-name> to the command line","If per-env, generate the flag from an env var with a guard: : \"${S3_BUCKET:?S3_BUCKET must be set}\"","Confirm the bucket exists and is writable by the given credentials — the next failure mode after this check is an S3 error from NewS3Storage"],"exampleFix":"// before\ntransfer.sh --provider s3 --aws-access-key AK --aws-secret-key SK\n// after\ntransfer.sh --provider s3 --aws-access-key AK --aws-secret-key SK --bucket my-uploads","handlingStrategy":"validation","validationCode":": \"${S3_BUCKET:?bucket required for s3 provider}\"\nargs+=(--bucket \"$S3_BUCKET\")","typeGuard":null,"tryCatchPattern":"if err := cmd.Root.Execute(); err != nil {\n  if strings.Contains(err.Error(), \"bucket not set\") {\n    log.Fatalf(\"S3 provider selected but --bucket is missing\")\n  }\n  os.Exit(1)\n}","preventionTips":["Parameterize bucket per environment and fail fast if the env var is unset","Pre-create the bucket and verify IAM permissions after fixing the flag","Keep a canonical s3 flag template (keys + bucket) in deployment configs"],"tags":["cli","configuration","s3","aws","bucket","startup-validation"],"backgroundTag":"missing-required-flag","analyzedSha":"c37bfd95797fd6da8a6da53fc13d191994b3f687","analyzedAt":"2026-09-05T10:21:07.548Z","contentChangedAt":"2026-09-05T10:21:07.548Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}