googleapis/mcp-toolbox · error
bucket cannot be empty for tool %q
Error message
bucket cannot be empty for tool %q
What it means
Thrown by cloudstorage-read-object Config.Initialize when the optional 'bucket' field is supplied as an empty string. When bucket is configured it must be a real GCS bucket name; otherwise remove the field so the bucket is provided per invocation.
Source
Thrown at internal/tools/cloudstorage/cloudstoragereadobject/cloudstoragereadobject.go:78
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Annotations *tools.ToolAnnotations `yaml:"annotations,omitempty"`
Bucket *string `yaml:"bucket,omitempty"`
}
// validate interface
var _ tools.ToolConfig = Config{}
func (cfg Config) ToolConfigType() string {
return resourceType
}
func (cfg Config) Initialize(context.Context) (tools.Tool, error) {
if cfg.Description == "" {
return nil, fmt.Errorf("description is required for tool %q", cfg.Name)
}
if cfg.Bucket != nil && *cfg.Bucket == "" {
return nil, fmt.Errorf("bucket cannot be empty for tool %q", cfg.Name)
}
objectParam := parameters.NewStringParameter(objectKey, "Full object name (path) within the bucket, e.g. 'path/to/file.txt'.")
rangeParam := parameters.NewStringParameter(rangeKey, "Optional HTTP byte range, e.g. 'bytes=0-999' (first 1000 bytes), 'bytes=-500' (last 500 bytes), or 'bytes=500-' (from byte 500 to end). Empty reads the full object.", parameters.WithStringDefault(""))
allParameters := parameters.Parameters{}
if cfg.Bucket == nil {
allParameters = append(allParameters, parameters.NewStringParameter(bucketKey, "Name of the Cloud Storage bucket containing the object."))
}
allParameters = append(allParameters, objectParam, rangeParam)
return Tool{
BaseTool: tools.NewBaseTool(
cfg,
tools.GetAnnotationsOrDefault(cfg.Annotations, tools.NewReadOnlyAnnotations),
tools.Manifest{Description: cfg.Description, Parameters: allParameters.Manifest(), AuthRequired: cfg.AuthRequired},
allParameters,
),
}, nilView on GitHub (pinned to 8cc6e09de2)
Solutions
- Remove the empty 'bucket' field from the tool config
- Set a valid bucket name (e.g. `bucket: my-bucket`)
- Correct the environment variable so it resolves to a non-empty bucket name
Example fix
// before
read-object:
kind: cloudstorage-read-object
source: my-gcs
description: Read object
bucket: ""
// after
read-object:
kind: cloudstorage-read-object
source: my-gcs
description: Read object
bucket: my-bucket Defensive patterns
Strategy: validation
Validate before calling
if b, exists := cfg["bucket"]; exists && (b == "" || b == nil) {
return errors.New("bucket must be a non-empty name or removed entirely")
} Prevention
- Do not quote empty values for optional fields; delete them instead
- Verify env substitutions in config-rendering logs
- Fail fast on empty interpolated values during templating
When it happens
Trigger: tools.yaml contains `bucket: ""` or an empty env-expanded value for a cloudstorage-read-object tool.
Common situations: Unset BUCKET environment variable interpolated to empty; leaving an empty quoted value instead of deleting the line; copy/paste of config skeletons.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- description is required for tool %q
- bucket cannot be empty for tool %q
- description is required for tool %q
- bucket cannot be empty for tool %q
- description is required for tool %q
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/62210abcf1795a28.
Report an issue: GitHub.