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-move-object Config.Initialize when the optional 'bucket' field is present but an empty string. Because move-object requires source and destination objects to be in the same bucket, a configured bucket must be a real bucket name; an empty one is rejected.
Source
Thrown at internal/tools/cloudstorage/cloudstoragemoveobject/cloudstoragemoveobject.go:75
tools.ConfigBase `yaml:",inline"`
Type string `yaml:"type" validate:"required"`
Source string `yaml:"source" validate:"required"`
Annotations *tools.ToolAnnotations `yaml:"annotations,omitempty"`
Bucket *string `yaml:"bucket,omitempty"`
}
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)
}
sourceObjectParam := parameters.NewStringParameter(sourceObjectKey, "Full source object name (path) within the bucket, e.g. 'path/to/file.txt'.")
destinationObjectParam := parameters.NewStringParameter(destinationObjectKey, "Full destination object name (path) within the same bucket, e.g. 'path/to/file.txt'.")
allParameters := parameters.Parameters{}
if cfg.Bucket == nil {
allParameters = append(allParameters, parameters.NewStringParameter(bucketKey, "Name of the Cloud Storage bucket containing the object to move."))
}
allParameters = append(allParameters, sourceObjectParam, destinationObjectParam)
return Tool{
BaseTool: tools.NewBaseTool(
cfg,
tools.GetAnnotationsOrDefault(cfg.Annotations, tools.NewDestructiveAnnotations),
tools.Manifest{Description: cfg.Description, Parameters: allParameters.Manifest(), AuthRequired: cfg.AuthRequired},
allParameters,
),
}, nilView on GitHub (pinned to 8cc6e09de2)
Solutions
- Delete the 'bucket' key from the tool config to make it a per-call parameter instead
- Provide a valid non-empty bucket name in the config
- Fix the env var/secret feeding the value so it is no longer empty
Example fix
// before
move-object:
kind: cloudstorage-move-object
source: my-gcs
description: Move object
bucket: ""
// after
move-object:
kind: cloudstorage-move-object
source: my-gcs
description: Move object
bucket: my-bucket Defensive patterns
Strategy: validation
Validate before calling
if v, ok := cfg["bucket"]; ok {
if s, isStr := v.(string); isStr && s == "" {
return errors.New("bucket configured as empty string; unset it or supply a name")
}
} Prevention
- Treat empty-string env expansions as failures in your deployment pipeline
- Prefer omitting optional fields over setting them to empty values
- Lint tools.yaml for empty required-if-present fields
When it happens
Trigger: tools.yaml sets `bucket: ""` or an empty-expanded variable for a cloudstorage-move-object tool.
Common situations: Missing environment variable for bucket name; clearing the bucket value intending to unset the field; YAML quoting mistakes.
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
- description is required for tool %q
- bucket cannot be empty for tool %q
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/e0464454e39c0df7.
Report an issue: GitHub.