dutchcoders/transfer.sh · error

gdrive-local-config-path not set.

Error message

gdrive-local-config-path not set.

What it means

Thrown by the transfer.sh CLI when --provider gdrive is chosen and --gdrive-client-json-filepath is set but --gdrive-local-config-path is empty. This flag points at the local file where the OAuth token/session state is cached between runs; without it the gdrive storage backend cannot persist authorization, so the CLI stops during startup validation.

Source

Thrown at cmd/cmd.go:504

		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))
			}
		case "local":

View on GitHub (pinned to c37bfd9579)

Solutions

  1. Add --gdrive-local-config-path /writable/dir/token.json pointing at a writable location
  2. Ensure the directory exists and the process user can write to it (needed to cache the OAuth token)
  3. Also set --basedir, which is validated next and will fail with its own error
  4. If running in a container, mount a writable volume for the token cache

Example fix

// before
transfer.sh --provider gdrive --gdrive-client-json-filepath /secrets/client_secret.json
// after
transfer.sh --provider gdrive --gdrive-client-json-filepath /secrets/client_secret.json --gdrive-local-config-path /data/gdrive-token.json --basedir /data
Defensive patterns

Strategy: validation

Validate before calling

TOKEN_PATH=/data/gdrive-token.json
mkdir -p "$(dirname "$TOKEN_PATH")" && touch "$TOKEN_PATH" \
  || { echo "token path not writable" >&2; exit 1; }
args+=(--gdrive-local-config-path "$TOKEN_PATH")

Try / catch

if err := cmd.Root.Execute(); err != nil {
  if strings.Contains(err.Error(), "gdrive-local-config-path not set") {
    log.Fatalf("gdrive provider requires --gdrive-local-config-path")
  }
  os.Exit(1)
}

Prevention

When it happens

Trigger: Running with --provider gdrive --gdrive-client-json-filepath X but no --gdrive-local-config-path; or the path interpolated to an empty string from an unset variable.

Common situations: Read-only container filesystems where operators deliberately dropped the token-cache path instead of configuring a writable one; migrating deployments where the token file location changed; copying the client-json flag from docs but skipping the rest of the gdrive example.

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


AI-assisted analysis of dutchcoders/transfer.sh@c37bfd9579 (2026-09-05). Data as JSON: /api/errors/248bf487c4b202cb. Report an issue: GitHub.