{"record":{"id":"0c1647b1a9deff39","repo":"dutchcoders/transfer.sh","slug":"basedir-not-set","errorCode":null,"errorMessage":"basedir not set.","messagePattern":"basedir not set\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cmd.go","lineNumber":506,"sourceCode":"\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))\n\t\t\t}\n\t\tcase \"storj\":\n\t\t\tif access := c.String(\"storj-access\"); access == \"\" {\n\t\t\t\treturn errors.New(\"storj-access not set.\")\n\t\t\t} else if bucket := c.String(\"storj-bucket\"); bucket == \"\" {\n\t\t\t\treturn errors.New(\"storj-bucket not set.\")\n\t\t\t} else if store, err := storage.NewStorjStorage(c.Context, access, bucket, purgeDays, 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 \"local\":\n\t\t\tif v := c.String(\"basedir\"); v == \"\" {\n\t\t\t\treturn errors.New(\"basedir not set.\")","sourceCodeStart":488,"sourceCodeEnd":524,"githubUrl":"https://github.com/dutchcoders/transfer.sh/blob/c37bfd95797fd6da8a6da53fc13d191994b3f687/cmd/cmd.go#L488-L524","documentation":"Thrown by the transfer.sh CLI in the gdrive branch of provider selection when --provider gdrive is used and both gdrive flags are present but --basedir is empty. The basedir is the root directory under which uploaded files are organized/stored locally; gdrive storage requires it, so the CLI fails validation before constructing the storage.","triggerScenarios":"Running with --provider gdrive, --gdrive-client-json-filepath and --gdrive-local-config-path set, but no --basedir (or an empty interpolation). Note the same message also appears for --provider local at a different code path (cmd.go:524).","commonSituations":"Configurations ported from an S3 deployment (which has no basedir requirement) to gdrive; a basedir env var like TRANSFER_BASEDIR unset in the container; multiple provider branches sharing a config template where basedir was only defined for the local provider.","solutions":["Add --basedir /path/to/storage to the command line when using --provider gdrive","Ensure the path exists and is writable by the process","If the same flags file serves multiple providers, verify the provider value actually matches the branch you configured flags for","After this check NewGDriveStorage runs — make sure the client JSON and token paths are valid to avoid the next error"],"exampleFix":"// before\ntransfer.sh --provider gdrive --gdrive-client-json-filepath /secrets/c.json --gdrive-local-config-path /data/token.json\n// after\ntransfer.sh --provider gdrive --gdrive-client-json-filepath /secrets/c.json --gdrive-local-config-path /data/token.json --basedir /data/uploads","handlingStrategy":"validation","validationCode":": \"${BASEDIR:?basedir required for gdrive provider}\"\nmkdir -p \"$BASEDIR\"\nargs+=(--basedir \"$BASEDIR\")","typeGuard":null,"tryCatchPattern":"if err := cmd.Root.Execute(); err != nil {\n  if strings.Contains(err.Error(), \"basedir not set\") {\n    log.Fatalf(\"provider requires --basedir\")\n  }\n  os.Exit(1)\n}","preventionTips":["Set --basedir for every provider branch that requires it (gdrive and local)","Verify the path exists and is writable before launch","When configs are shared across providers, generate basedir from a mandatory env var"],"tags":["cli","configuration","gdrive","google-drive","basedir","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"}