{"record":{"id":"1eeb2edf855336db","repo":"gofr-dev/gofr","slug":"bucket-name-must-not-be-empty","errorCode":null,"errorMessage":"bucket name must not be empty","messagePattern":"bucket name must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gofr/datasource/influxdb/influxdb.go","lineNumber":53,"sourceCode":"}\n\ntype HealthInflux struct {\n\tURL      string\n\tToken    string\n\tUsername string\n\tPassword string\n}\n\nconst (\n\tstatusDown = \"DOWN\"\n\tstatusUp   = \"UP\"\n)\n\nvar (\n\terrEmptyOrganizationName = errors.New(\"organization name must not be empty\")\n\terrEmptyOrganizationID   = errors.New(\"organization id must not be empty\")\n\terrEmptyBucketID         = errors.New(\"bucket id must not be empty\")\n\terrEmptyBucketName       = errors.New(\"bucket name must not be empty\")\n\terrFetchOrganization     = errors.New(\"failed to fetch all organizations\")\n\terrHealthCheckFailed     = errors.New(\"influxdb health check failed\")\n)\n\n// CreateOrganization creates a new organization in InfluxDB with the specified name.\n// It implements the container.InfluxDBProvider interface.\n//\n// Parameters:\n// - ctx: Context for request cancellation and timeouts.\n// - orgName: The name of the organization to be created. Must not be empty.\n//\n// Returns:\n// - string: The ID of the newly created organization.\n// - error: Error if organization creation fails or if orgName is empty.\nfunc (c *Client) CreateOrganization(ctx context.Context, orgName string) (string, error) {\n\tif orgName == \"\" {\n\t\treturn \"\", errEmptyOrganizationName\n\t}","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/gofr-dev/gofr/blob/187eb24962502e91f1fee856230670958b66e89c/pkg/gofr/datasource/influxdb/influxdb.go#L35-L71","documentation":"errEmptyBucketName is a sentinel error returned by CreateBucket when the requested bucket name is an empty string. InfluxDB requires a bucket name, so the gofr datasource validates it before making the API call.","triggerScenarios":"Calling CreateBucket with a config/struct whose Name field is \"\".","commonSituations":"Building bucket options from user input without validation; template or config interpolation that rendered to empty; typo in the config key (e.g. bucketid vs bucketName).","solutions":["Set a non-empty Name on the bucket options before CreateBucket","Validate user-supplied bucket names at the input boundary","Check the config file/env key spelling feeding the name"],"exampleFix":"// before\nclient.CreateBucket(ctx, BucketConfig{Name: \"\"})\n// after\nif name == \"\" {\n    return errors.New(\"bucket name is required\")\n}\nclient.CreateBucket(ctx, BucketConfig{Name: name})","handlingStrategy":"validation","validationCode":"if name == \"\" {\n    return errors.New(\"bucket name is required\")\n}\nclient.CreateBucket(ctx, BucketConfig{Name: name})","typeGuard":null,"tryCatchPattern":"if err := client.CreateBucket(ctx, cfg); err != nil {\n    if err.Error() == \"bucket name must not be empty\" {\n        // reject input upstream\n    }\n}","preventionTips":["Validate user input for required name fields","Use request DTO validation before reaching the datasource","Check config key spelling for name fields"],"tags":["influxdb","validation","empty-identifier","gofr"],"backgroundTag":"missing-required-argument","analyzedSha":"187eb24962502e91f1fee856230670958b66e89c","analyzedAt":"2026-09-01T20:34:54.554Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}