{"record":{"id":"22d7041c0b102d3b","repo":"gastownhall/beads","slug":"uow-database-name-must-not-be-empty-caller-shoul","errorCode":null,"errorMessage":"uow: database name must not be empty (caller should default to %q)","messagePattern":"uow: database name must not be empty \\(caller should default to %q\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/uow/doltserver_provider.go","lineNumber":36,"sourceCode":"\tserverRootDir string,\n\tdatabase string,\n\tserverLogFilePath string,\n\tserverConfigFilePath string,\n\tbackend proxy.Backend,\n\trootUser string,\n\trootPassword string,\n\tdoltBinExec string,\n\tproxyPort int,\n\tidleTimeout time.Duration,\n\tteamServer bool,\n\texpectedProjectID string,\n\topts ...ProviderOption,\n) (UnitOfWorkProvider, error) {\n\tif idleTimeout == 0 {\n\t\tidleTimeout = defaultProxyIdleTimeout\n\t}\n\tif database == \"\" {\n\t\treturn nil, fmt.Errorf(\"uow: database name must not be empty (caller should default to %q)\", \"beads\")\n\t}\n\tif err := backend.Validate(); err != nil {\n\t\treturn nil, fmt.Errorf(\"uow: backend: %w\", err)\n\t}\n\tif rootUser == \"\" {\n\t\treturn nil, fmt.Errorf(\"uow: rootUser must not be empty\")\n\t}\n\tif doltBinExec == \"\" {\n\t\treturn nil, fmt.Errorf(\"uow: doltBinExec must not be empty\")\n\t}\n\n\tabsServerRootDir, err := filepath.Abs(serverRootDir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"uow: resolving server root dir: %w\", err)\n\t}\n\tabsDoltBinExec, err := filepath.Abs(doltBinExec)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"uow: resolving dolt bin exec: %w\", err)","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/uow/doltserver_provider.go#L18-L54","documentation":"NewDoltServerUOWProvider requires an explicit database name; passing an empty string is rejected immediately. The message tells the caller the library convention is to default to \"beads\" but does not apply the default itself. This is a fail-fast guard so a misconfigured provider never starts against a nameless database.","triggerScenarios":"Calling NewDoltServerUOWProvider with database == \"\", typically because the value came from an unset config field, empty env var, or an untrimmed CLI flag.","commonSituations":"BEADS_DB or similar env var unset; config file missing the database key; caller forgot to apply the \"beads\" default before constructing the provider.","solutions":["Pass a non-empty database name, e.g. \"beads\"","If the value comes from config/env, apply a default: if db == \"\" { db = \"beads\" } before calling","Trim whitespace from user/config supplied names before validation"],"exampleFix":"// before\nprov, err := NewDoltServerUOWProvider(ctx, dir, cfg.Database, ...)\n// after\ndb := cfg.Database\nif db == \"\" { db = \"beads\" }\nprov, err := NewDoltServerUOWProvider(ctx, dir, db, ...)","handlingStrategy":"validation","validationCode":"func validateDBName(db string) error {\n    if strings.TrimSpace(db) == \"\" {\n        return fmt.Errorf(\"database name required; default to %q\", \"beads\")\n    }\n    return nil\n}\n// call before NewDoltServerUOWProvider","typeGuard":"func hasDatabaseName(cfg Config) bool { return strings.TrimSpace(cfg.Database) != \"\" }","tryCatchPattern":"if err := validateDBName(dbName); err != nil { return err }\nprov, err := NewDoltServerUOWProvider(ctx, dir, dbName, ...)\nif err != nil && strings.Contains(err.Error(), \"database name must not be empty\") {\n    return fmt.Errorf(\"config error: %w\", err)\n}","preventionTips":["Apply the \"beads\" default at config-load time, not at call time","Trim and validate all string config values before constructing providers","Add a unit test asserting the config loader never yields an empty database name"],"tags":["validation","config","database"],"backgroundTag":"missing-required-parameter","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}