{"record":{"id":"3c79966a33b56b6f","repo":"gastownhall/beads","slug":"bd-admin-s-is-not-yet-supported-in-embedded-mod","errorCode":null,"errorMessage":"'bd admin %s' is not yet supported in embedded mode","messagePattern":"'bd admin (.+?)' is not yet supported in embedded mode","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/admin.go","lineNumber":17,"sourceCode":"package main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/spf13/cobra\"\n)\n\n// requireServerMode returns an error if bd is running in embedded mode.\n// Used by admin subcommands to guard against embedded-mode execution.\n// This must be called inside RunE (after store init), not in PersistentPreRunE,\n// because !usesSQLServer() reads cmdCtx.ServerMode which is only populated\n// after main.go's PersistentPreRun completes (cobra runs child PreRunE before\n// parent PreRun, so the check fires too early if placed on adminCmd itself).\nfunc requireServerMode(cmdName string) error {\n\tif !usesSQLServer() {\n\t\treturn fmt.Errorf(\"'bd admin %s' is not yet supported in embedded mode\", cmdName)\n\t}\n\treturn nil\n}\n\nvar adminCmd = &cobra.Command{\n\tUse:     \"admin\",\n\tGroupID: \"advanced\",\n\tShort:   \"Administrative commands for database maintenance\",\n\tLong: `Administrative commands for beads database maintenance.\n\nThese commands are for advanced users and should be used carefully:\n  cleanup   Delete closed issues (issue lifecycle)\n  compact   Compact old closed issues to save space (storage optimization)\n  reset     Remove all beads data and configuration (full reset)\n\nFor routine maintenance, prefer 'bd doctor --fix' which handles common repairs\nautomatically. Use these admin commands for targeted database operations.`,\n}","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/admin.go#L1-L35","documentation":"requireServerMode guards `bd admin` subcommands (e.g. reset) that are only implemented against a SQL server backend. When bd is running in embedded mode, the admin operation cannot be performed and this error names the subcommand. The check is intentionally placed inside RunE because ServerMode is only populated after main.go's PersistentPreRun completes.","triggerScenarios":"Running `bd admin <subcommand>` (e.g. `bd admin reset`) in a repository using an embedded (non-SQL-server) backend; usesSQLServer() returns false.","commonSituations":"Users on the default embedded Dolt setup attempting admin maintenance commands; scripts written against server-mode deployments run locally on embedded repos.","solutions":["Start/use server mode: initialize with `bd init --server` and run the admin command against the server","Skip the admin subcommand and use an embedded-mode equivalent (e.g. manual repair or bd doctor where gated)","Upgrade bd — embedded-mode support for admin subcommands is enabled one at a time (GH#3794)"],"exampleFix":"// before\nbd admin reset\n// error: 'bd admin reset' is not yet supported in embedded mode\n// after\nbd init --server && bd admin reset","handlingStrategy":"validation","validationCode":"// check backend before invoking admin subcommands\nif !usesSQLServer() {\n    return errors.New(\"bd admin requires server mode; run bd init --server\")\n}","typeGuard":null,"tryCatchPattern":"if err := bdAdminReset(ctx); err != nil {\n    if strings.Contains(err.Error(), \"not yet supported in embedded mode\") {\n        return initServerModeThenRetry()\n    }\n    return err\n}","preventionTips":["Run admin commands only against server-mode repos","Gate admin automation on usesSQLServer() equivalent checks","Track GH#3794 for embedded-mode admin support rollouts"],"tags":["cli","embedded-mode","admin","server-mode"],"backgroundTag":"command-requires-server-mode","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}