dutchcoders/transfer.sh · error
gdrive-client-json-filepath not set.
Error message
gdrive-client-json-filepath not set.
What it means
Thrown by the transfer.sh CLI when --provider gdrive is selected but --gdrive-client-json-filepath is empty. Google Drive storage is initialized from an OAuth client credentials JSON file, and this flag tells the CLI where that file lives; without it NewGDriveStorage cannot be configured, so startup fails fast.
Source
Thrown at cmd/cmd.go:502
switch provider := c.String("provider"); provider {
case "s3":
if accessKey := c.String("aws-access-key"); accessKey == "" {
return errors.New("access-key not set.")
} else if secretKey := c.String("aws-secret-key"); secretKey == "" {
return errors.New("secret-key not set.")
} else if bucket := c.String("bucket"); bucket == "" {
return errors.New("bucket not set.")
} 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 {
return err
} else {
options = append(options, server.UseStorage(store))
}
case "gdrive":
chunkSize := c.Int("gdrive-chunk-size") * 1024 * 1024
if clientJSONFilepath := c.String("gdrive-client-json-filepath"); clientJSONFilepath == "" {
return errors.New("gdrive-client-json-filepath not set.")
} else if localConfigPath := c.String("gdrive-local-config-path"); localConfigPath == "" {
return errors.New("gdrive-local-config-path not set.")
} else if basedir := c.String("basedir"); basedir == "" {
return errors.New("basedir not set.")
} else if store, err := storage.NewGDriveStorage(c.Context, clientJSONFilepath, localConfigPath, basedir, chunkSize, logger); err != nil {
return err
} else {
options = append(options, server.UseStorage(store))
}
case "storj":
if access := c.String("storj-access"); access == "" {
return errors.New("storj-access not set.")
} else if bucket := c.String("storj-bucket"); bucket == "" {
return errors.New("storj-bucket not set.")
} else if store, err := storage.NewStorjStorage(c.Context, access, bucket, purgeDays, logger); err != nil {
return err
} else {
options = append(options, server.UseStorage(store))View on GitHub (pinned to c37bfd9579)
Solutions
- Provide --gdrive-client-json-filepath /path/to/client_secret.json pointing at your Google OAuth client credentials
- Verify the file actually exists at that path and is readable by the process user
- Remember the follow-up required flags: --gdrive-local-config-path and --basedir are validated next
- Mount the JSON into the container and pass the in-container path, not the host path
Example fix
// before transfer.sh --provider gdrive --gdrive-local-config-path /config/token.json --basedir /data // after transfer.sh --provider gdrive --gdrive-client-json-filepath /secrets/client_secret.json --gdrive-local-config-path /config/token.json --basedir /data
Defensive patterns
Strategy: validation
Validate before calling
CLIENT_JSON=/secrets/client_secret.json if [ ! -r "$CLIENT_JSON" ]; then echo "missing $CLIENT_JSON" >&2; exit 1; fi args+=(--gdrive-client-json-filepath "$CLIENT_JSON")
Try / catch
if err := cmd.Root.Execute(); err != nil {
if strings.Contains(err.Error(), "gdrive-client-json-filepath not set") {
log.Fatalf("gdrive provider requires --gdrive-client-json-filepath")
}
os.Exit(1)
} Prevention
- Mount the OAuth client JSON into the container and pass the in-container path
- Validate the file exists and is readable in the startup script before launch
- Set all three gdrive flags (client json, local config path, basedir) together
When it happens
Trigger: Running with --provider gdrive and no --gdrive-client-json-filepath — path never provided, env interpolation empty, or the credentials file not mounted into the container.
Common situations: First-time gdrive setup where the OAuth client JSON was downloaded but never wired into the flags; container images that omitted the credentials mount at /secrets; docs/config drift after migrating from local to containerized deployment.
Understand the failure class
Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.
Related errors
- gdrive-local-config-path not set.
- basedir not set.
- clamav-host not set
- access-key not set.
- secret-key not set.
AI-assisted analysis of dutchcoders/transfer.sh@c37bfd9579 (2026-09-05).
Data as JSON: /api/errors/b946595e1eaf5ad9.
Report an issue: GitHub.