{"record":{"id":"9246254e82e266f7","repo":"gastownhall/beads","slug":"database-not-available-w-924625","errorCode":null,"errorMessage":"database not available: %w","messagePattern":"database not available: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/jira.go","lineNumber":333,"sourceCode":"\t} else {\n\t\tfmt.Println(\"Last Sync:    Never\")\n\t}\n\tfmt.Println()\n\tfmt.Printf(\"Total Issues: %d\\n\", len(allIssues))\n\tfmt.Printf(\"With Jira:    %d\\n\", withJiraRef)\n\tfmt.Printf(\"Local Only:   %d\\n\", pendingPush)\n\n\tif pendingPush > 0 {\n\t\tfmt.Println()\n\t\tfmt.Printf(\"Run 'bd jira sync --push' to push %d local issue(s) to Jira\\n\", pendingPush)\n\t}\n\treturn nil\n}\n\n// validateJiraConfig checks that required Jira configuration is present.\nfunc validateJiraConfig() error {\n\tif err := ensureStoreActive(); err != nil {\n\t\treturn fmt.Errorf(\"database not available: %w\", err)\n\t}\n\n\tctx := rootCtx\n\tjiraURL, _ := store.GetConfig(ctx, \"jira.url\")\n\n\tif jiraURL == \"\" {\n\t\treturn fmt.Errorf(\"jira.url not configured\\nRun: bd config set jira.url \\\"https://company.atlassian.net\\\"\")\n\t}\n\n\t// Check for project configuration (singular or plural).\n\tpluralProjects, _ := store.GetConfig(ctx, \"jira.projects\")\n\tsingularProject, _ := store.GetConfig(ctx, \"jira.project\")\n\tprojectKeys := tracker.ResolveProjectIDs(nil, pluralProjects, singularProject)\n\tif len(projectKeys) == 0 {\n\t\treturn fmt.Errorf(\"no Jira project configured\\nRun: bd config set jira.project \\\"PROJ\\\"\\nOr:  bd config set jira.projects \\\"PROJ1,PROJ2\\\"\")\n\t}\n\n\tapiToken, _ := store.GetConfig(ctx, \"jira.api_token\")","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/jira.go#L315-L351","documentation":"validateJiraConfig is the pre-flight check run by `bd jira sync/push/pull`. It first calls ensureStoreActive(); if the local bd database cannot be opened or is not initialized, the error is wrapped as 'database not available: %w'. No Jira validation happens until storage is usable.","triggerScenarios":"Running any `bd jira` subcommand outside an initialized bd workspace, with a missing/corrupt .beads database, or when the Dolt-backed store fails to open (server down, bad config, wrong cwd).","commonSituations":"Running bd jira in a repo without `bd init`; deleted or corrupted .beads directory; Dolt server not reachable for synced mode; running from a subdirectory with a misconfigured database path.","solutions":["Run `bd init` in the repository to create the local database","Verify you are in the intended repo root / workspace where .beads exists","Inspect the wrapped error: if Dolt connectivity is the cause, start/restart the Dolt server or fix config","Run `bd doctor` to diagnose the database state"],"exampleFix":"// before\n$ bd jira sync\ndatabase not available: no database found\n// after\n$ bd init\n$ bd jira sync","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(\".beads\"); os.IsNotExist(err) {\n    return errors.New(\"bd workspace missing: run `bd init` before bd jira commands\")\n}","typeGuard":null,"tryCatchPattern":"if err := runJiraSync(cmd, args); err != nil {\n    if strings.Contains(err.Error(), \"database not available\") {\n        fmt.Fprintln(os.Stderr, \"Run `bd init` first, then check `bd doctor`\")\n        os.Exit(1)\n    }\n    return err\n}","preventionTips":["Always run `bd init` before any bd jira subcommand","Execute bd from the repository root where .beads lives","Run `bd doctor` after environment changes (new machine, CI image)","Keep the Dolt server running for synced-mode workspaces"],"tags":["database","jira","storage","dolt"],"backgroundTag":"database-unavailable","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}