gastownhall/beads · error

--source-db and --output are required

Error message

--source-db and --output are required

What it means

Validation error in the legacy SQLite export subcommand: both --source-db and --output flags must be provided. RunE checks the flag values and refuses to run the export when either is empty. The command has SilenceUsage/SilenceErrors, so this message is delivered through the command's own error handling.

Source

Thrown at cmd/bd/legacy_sqlite_reader.go:22

	"fmt"
	"os"

	"github.com/spf13/cobra"
	"github.com/steveyegge/beads/internal/migration/legacysqlite"
)

var legacySQLiteCmd = &cobra.Command{
	Use:           "legacy-sqlite --source-db PATH --output PATH|-",
	Short:         "Read an authenticated legacy SQLite database as JSONL",
	Annotations:   map[string]string{skipStoreAnnotation: "1"},
	Args:          cobra.NoArgs,
	SilenceUsage:  true,
	SilenceErrors: true,
	RunE: func(cmd *cobra.Command, _ []string) error {
		source, _ := cmd.Flags().GetString("source-db")
		output, _ := cmd.Flags().GetString("output")
		if source == "" || output == "" {
			return fmt.Errorf("--source-db and --output are required")
		}
		return legacysqlite.Export(cmd.Context(), source, output, os.Stdout)
	},
}

func init() {
	migrateCmd.AddCommand(legacySQLiteCmd)
	legacySQLiteCmd.Flags().String("source-db", "", "Legacy SQLite database (read-only)")
	legacySQLiteCmd.Flags().String("output", "", "JSONL output path, or - for stdout")
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Re-run with both flags: --source-db <path-to-legacy.db> --output <export-path>
  2. Check your script/wrapper passes non-empty values (quote paths, verify with set -x)
  3. Run the command's --help to confirm exact flag names

Example fix

// before
bd legacy-sqlite-export --source-db old.db
// after
bd legacy-sqlite-export --source-db old.db --output issues.jsonl
Defensive patterns

Strategy: validation

Validate before calling

// shell pre-check before invoking the command
[ -n "$SOURCE_DB" ] && [ -n "$OUTPUT" ] && [ -f "$SOURCE_DB" ] || { echo "--source-db and --output are required"; exit 1; }

Prevention

When it happens

Trigger: Invoking the legacy SQLite export command without --source-db, without --output, or with either flag set to an empty string.

Common situations: Scripting the one-time migration export from an old beads SQLite database and omitting flags; copying an invocation example but dropping required arguments; flags defined but never bound to defaults.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/d1026c20c0a5813c. Report an issue: GitHub.