{"record":{"id":"47831c8932543fcd","repo":"googleapis/mcp-toolbox","slug":"destination-bucket-cannot-be-empty-for-tool-q","errorCode":null,"errorMessage":"destination_bucket cannot be empty for tool %q","messagePattern":"destination_bucket cannot be empty for tool %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/cloudstorage/cloudstoragecopyobject/cloudstoragecopyobject.go","lineNumber":80,"sourceCode":"\tSourceBucket      *string                `yaml:\"source_bucket,omitempty\"`\n\tDestinationBucket *string                `yaml:\"destination_bucket,omitempty\"`\n}\n\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.SourceBucket != nil && *cfg.SourceBucket == \"\" {\n\t\treturn nil, fmt.Errorf(\"source_bucket cannot be empty for tool %q\", cfg.Name)\n\t}\n\tif cfg.DestinationBucket != nil && *cfg.DestinationBucket == \"\" {\n\t\treturn nil, fmt.Errorf(\"destination_bucket cannot be empty for tool %q\", cfg.Name)\n\t}\n\n\tsourceObjectParam := parameters.NewStringParameter(sourceObjectKey, \"Full source object name (path) within the source bucket, e.g. 'path/to/file.txt'.\")\n\tdestinationObjectParam := parameters.NewStringParameter(destinationObjectKey, \"Full destination object name (path) within the destination bucket, e.g. 'path/to/file.txt'.\")\n\tallParameters := parameters.Parameters{}\n\tif cfg.SourceBucket == nil {\n\t\tallParameters = append(allParameters, parameters.NewStringParameter(sourceBucketKey, \"Name of the Cloud Storage bucket containing the source object.\"))\n\t}\n\tallParameters = append(allParameters, sourceObjectParam)\n\tif cfg.DestinationBucket == nil {\n\t\tallParameters = append(allParameters, parameters.NewStringParameter(destinationBucketKey, \"Name of the Cloud Storage bucket to copy into.\"))\n\t}\n\tallParameters = append(allParameters, destinationObjectParam)\n\n\treturn Tool{\n\t\tBaseTool: tools.NewBaseTool(\n\t\t\tcfg,\n\t\t\ttools.GetAnnotationsOrDefault(cfg.Annotations, tools.NewDestructiveAnnotations),","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudstorage/cloudstoragecopyobject/cloudstoragecopyobject.go#L62-L98","documentation":"Same pattern as source_bucket: destination_bucket is optional (*string) but must be non-empty when provided. Initialize rejects an explicitly empty destination bucket because the copy tool cannot resolve a target.","triggerScenarios":"`destinationBucket: \"\"` in tools.yaml, or an env/templated value that resolved to the empty string during config load.","commonSituations":"Copy-pasting the source_bucket block and forgetting to fill in the value; unset DEST_BUCKET env var; YAML key with no value.","solutions":["Provide a concrete destination bucket name or remove the key so it becomes an invocation-time parameter","Fix the environment variable substitution that produced the empty string","Validate rendered config files in CI before starting the server"],"exampleFix":"// before\n  destinationBucket: \"\"\n// after\n  destinationBucket: my-dest-bucket","handlingStrategy":"validation","validationCode":"func checkDestBucket(name string, ptr *string) error {\n    if ptr != nil && *ptr == \"\" {\n        return fmt.Errorf(\"tool %s: destination_bucket set but empty\", name)\n    }\n    return nil\n}","typeGuard":"func hasNonEmptyDestBucket(p *string) bool { return p == nil || *p != \"\" }","tryCatchPattern":"tool, err := cfg.Initialize(ctx)\nif err != nil && strings.Contains(err.Error(), \"destination_bucket cannot be empty\") {\n    return fmt.Errorf(\"provide a real destination bucket or omit the key: %w\", err)\n}","preventionTips":["Fill in concrete bucket names rather than placeholders","Check DEST_BUCKET-style env vars in the deployment environment","Do not copy source_bucket blocks without editing values","Validate rendered configs in CI"],"tags":["config","validation","yaml","cloud-storage"],"backgroundTag":"missing-required-config-field","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"}