{"record":{"id":"aea5c72d5b7bbb17","repo":"googleapis/mcp-toolbox","slug":"bucket-cannot-be-empty-for-tool-q-aea5c7","errorCode":null,"errorMessage":"bucket cannot be empty for tool %q","messagePattern":"bucket cannot be empty for tool %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/cloudstorage/cloudstoragedownloadobject/cloudstoragedownloadobject.go","lineNumber":79,"sourceCode":"\tAnnotations      *tools.ToolAnnotations `yaml:\"annotations,omitempty\"`\n\tBucket           *string                `yaml:\"bucket,omitempty\"`\n\tDestinationDir   *string                `yaml:\"destination_dir,omitempty\"`\n\tOverwrite        *bool                  `yaml:\"overwrite,omitempty\"`\n}\n\n// validate interface\nvar _ tools.ToolConfig = Config{}\n\nfunc (cfg Config) ToolConfigType() string {\n\treturn resourceType\n}\n\nfunc (cfg Config) Initialize(context.Context) (tools.Tool, error) {\n\tif cfg.Description == \"\" {\n\t\treturn nil, fmt.Errorf(\"description is required for tool %q\", cfg.Name)\n\t}\n\tif cfg.Bucket != nil && *cfg.Bucket == \"\" {\n\t\treturn nil, fmt.Errorf(\"bucket cannot be empty for tool %q\", cfg.Name)\n\t}\n\tif cfg.DestinationDir != nil {\n\t\tif *cfg.DestinationDir == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"destination_dir cannot be empty for tool %q\", cfg.Name)\n\t\t}\n\t\tif _, err := cloudstoragecommon.ValidateLocalPath(*cfg.DestinationDir); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"destination_dir is invalid for tool %q: %w\", cfg.Name, err)\n\t\t}\n\t}\n\n\tobjectParam := parameters.NewStringParameter(objectKey, \"Full object name (path) within the bucket, e.g. 'path/to/file.txt'.\")\n\tdestinationDesc := \"Absolute local filesystem path where the object will be written. Relative paths and paths containing '..' are rejected.\"\n\tif cfg.DestinationDir != nil {\n\t\tdestinationDesc = \"Relative path under the configured destination_dir where the object will be written. Absolute paths and paths that escape destination_dir are rejected.\"\n\t}\n\tallParameters := parameters.Parameters{}\n\tif cfg.Bucket == nil {\n\t\tallParameters = append(allParameters, parameters.NewStringParameter(bucketKey, \"Name of the Cloud Storage bucket containing the object.\"))","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudstorage/cloudstoragedownloadobject/cloudstoragedownloadobject.go#L61-L97","documentation":"Initialize for cloudstorage-download-object rejects a statically configured bucket that is an empty string. Either give a concrete bucket name or omit the field so a bucket parameter is injected for callers.","triggerScenarios":"bucket: \"\" in the tool config, commonly from an unexpanded/empty environment variable like ${GCS_BUCKET} in tools.yaml.","commonSituations":"Missing env var at server start; CI pipelines not passing secrets; leftover bucket: key with no value after editing.","solutions":["Provide a valid bucket name in the bucket field","Remove the bucket field to make it a runtime parameter instead","Ensure the env var referenced in YAML is set in the process environment"],"exampleFix":"// before\nbucket: \"${GCS_BUCKET}\"   # GCS_BUCKET unset => \"\"\n// after\nbucket: my-actual-bucket   # or remove the key to require it per-call","handlingStrategy":"validation","validationCode":"if b, ok := toolCfg[\"bucket\"]; ok && b == \"\" {\n    return errors.New(\"bucket must be a real name or omitted\")\n}","typeGuard":null,"tryCatchPattern":"if err := startToolbox(); err != nil {\n    if strings.Contains(err.Error(), \"bucket cannot be empty\") {\n        // check ${GCS_BUCKET} expansion\n    }\n    log.Fatal(err)\n}","preventionTips":["Fail fast if env vars interpolated into YAML are empty","Provide defaults in deployment manifests","Omit bucket for per-call parameters"],"tags":["go","mcp-toolbox","configuration","env-var"],"backgroundTag":"empty-required-parameter","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}