{"record":{"id":"e26a2667f0bca11b","repo":"googleapis/mcp-toolbox","slug":"bucket-cannot-be-empty-for-tool-q-e26a26","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/cloudstoragelistobjects/cloudstoragelistobjects.go","lineNumber":84,"sourceCode":"\tAnnotations      *tools.ToolAnnotations `yaml:\"annotations,omitempty\"`\n\tBucket           *string                `yaml:\"bucket,omitempty\"`\n\tPrefix           *string                `yaml:\"prefix,omitempty\"`\n\tDelimiter        *string                `yaml:\"delimiter,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\n\tmaxResultsParam := parameters.NewIntParameter(maxResultsKey, \"Maximum number of objects to return per page. A value of 0 uses the API default (1000); negative values and values above 1000 are rejected.\", parameters.WithIntDefault(0))\n\tpageTokenParam := parameters.NewStringParameter(pageTokenKey, \"A previously-returned page token for retrieving the next page of results.\", parameters.WithStringDefault(\"\"))\n\tallParameters := parameters.Parameters{}\n\tif cfg.Bucket == nil {\n\t\tallParameters = append(allParameters, parameters.NewStringParameter(bucketKey, \"Name of the Cloud Storage bucket to list objects from.\"))\n\t}\n\tif cfg.Prefix == nil {\n\t\tallParameters = append(allParameters, parameters.NewStringParameter(prefixKey, \"Filter results to objects whose names begin with this prefix.\", parameters.WithStringDefault(\"\")))\n\t}\n\tif cfg.Delimiter == nil {\n\t\tallParameters = append(allParameters, parameters.NewStringParameter(delimiterKey, \"Delimiter used to group object names (typically '/'). When set, common prefixes are returned as 'prefixes'.\", parameters.WithStringDefault(\"\")))\n\t}\n\tallParameters = append(allParameters, maxResultsParam, pageTokenParam)\n\n\treturn Tool{\n\t\tBaseTool: tools.NewBaseTool(","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudstorage/cloudstoragelistobjects/cloudstoragelistobjects.go#L66-L102","documentation":"Thrown by cloudstorage-list-objects Config.Initialize when the config supplies a 'bucket' value that is an empty string. Bucket is an optional field; when set it must point to a real GCS bucket, so an explicit empty string is treated as a config error rather than 'use bucket parameter at call time'.","triggerScenarios":"tools.yaml contains `bucket: \"\"` (or a template/variable that expanded to empty) for a cloudstorage-list-objects tool while the field is non-nil.","commonSituations":"Environment variable for the bucket name not set, causing empty expansion; quoting an empty YAML value intending to leave the field unset; copying a config and clearing the bucket to force per-call bucket supply.","solutions":["Remove the 'bucket' field entirely from the tool config so buckets are supplied per invocation","Set the bucket to a valid non-empty GCS bucket name (e.g. `bucket: my-bucket`)","Fix the environment variable/secret so it expands to the actual bucket name instead of empty"],"exampleFix":"// before\ntools:\n  list-objects:\n    kind: cloudstorage-list-objects\n    source: my-gcs\n    description: List objects\n    bucket: \"\"\n// after\ntools:\n  list-objects:\n    kind: cloudstorage-list-objects\n    source: my-gcs\n    description: List objects\n    bucket: my-bucket","handlingStrategy":"validation","validationCode":"// Pre-check: bucket must be either absent or non-empty\nif b, present := toolCfg[\"bucket\"]; present && strings.TrimSpace(fmt.Sprint(b)) == \"\" {\n    return fmt.Errorf(\"bucket is set but empty; remove it or provide a real bucket name\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit the bucket key instead of writing bucket: \"\" when you want per-call buckets","Check that env vars referenced in the config are set in the deployment environment","Validate rendered config (after env expansion) before server start"],"tags":["go","configuration","cloud-storage","validation"],"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"}