{"record":{"id":"df3144cb2af32209","repo":"gastownhall/beads","slug":"uow-rootuser-must-not-be-empty","errorCode":null,"errorMessage":"uow: rootUser must not be empty","messagePattern":"uow: rootUser must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/uow/doltserver_provider.go","lineNumber":42,"sourceCode":"\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)\n\t}\n\n\tif err := os.MkdirAll(absServerRootDir, config.BeadsDirPerm); err != nil {\n\t\treturn nil, fmt.Errorf(\"uow: creating server root directory: %w\", err)\n\t}\n","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/uow/doltserver_provider.go#L24-L60","documentation":"NewDoltServerUOWProvider requires a non-empty root SQL user name used to connect and run schema DDL. An empty rootUser is rejected up front. Without it the MySQL DSN would be malformed or the server would fall back to an unintended authenticated user.","triggerScenarios":"Calling NewDoltServerUOWProvider with rootUser == \"\", usually from an unset config key or env var holding the Dolt server superuser.","commonSituations":"Config migration dropped the user field; caller assumed a default root user exists; password set but username field left blank.","solutions":["Pass \"root\" (or your configured admin user) as rootUser","Default from config: if user == \"\" { user = \"root\" }","Verify the config file/env actually populates the user field"],"exampleFix":"// before\nprov, err := NewDoltServerUOWProvider(ctx, dir, db, log, cfg, backend, cfg.User, ...)\n// after\nuser := cfg.User\nif user == \"\" { user = \"root\" }\nprov, err := NewDoltServerUOWProvider(ctx, dir, db, log, cfg, backend, user, ...)","handlingStrategy":"validation","validationCode":"if rootUser == \"\" {\n    return errors.New(\"rootUser required (use \\\"root\\\" for the Dolt admin user)\")\n}\n// call before NewDoltServerUOWProvider","typeGuard":"func hasRootUser(cfg Config) bool { return strings.TrimSpace(cfg.RootUser) != \"\" }","tryCatchPattern":"if err := validateRootUser(rootUser); err != nil { return err }\nprov, err := NewDoltServerUOWProvider(..., rootUser, ...)\nif err != nil && strings.Contains(err.Error(), \"rootUser must not be empty\") {\n    return fmt.Errorf(\"config error: %w\", err)\n}","preventionTips":["Default rootUser to \"root\" at config load when unset","Never read credentials fields without a presence check","Document required provider arguments in the config template"],"tags":["validation","config","authentication"],"backgroundTag":"missing-required-parameter","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}