fix(daemon): propagate startup failure reason to user (GH#863)
When daemon fails to start due to legacy database or fingerprint validation, the error was only logged to daemon.log. Users saw "Daemon took too long" with no hint about the actual problem. Changes: - Write validation errors to .beads/daemon-error file before daemon exits - Check for daemon-error file in autostart and display contents on timeout - Elevate legacy database check in bd doctor from warning to error Now when daemon fails due to legacy database, users see: "LEGACY DATABASE DETECTED! ... Run 'bd migrate --update-repo-id' to add fingerprint" Instead of just "Daemon took too long to start". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -441,12 +441,12 @@ func CheckRepoFingerprint(path string) DoctorCheck {
|
||||
err = db.QueryRow("SELECT value FROM metadata WHERE key = 'repo_id'").Scan(&storedRepoID)
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows || strings.Contains(err.Error(), "no such table") {
|
||||
// Legacy database without repo_id
|
||||
// Legacy database without repo_id - this is an error because daemon won't start
|
||||
return DoctorCheck{
|
||||
Name: "Repo Fingerprint",
|
||||
Status: StatusWarning,
|
||||
Status: StatusError,
|
||||
Message: "Legacy database (no fingerprint)",
|
||||
Detail: "Database was created before version 0.17.5",
|
||||
Detail: "Database was created before version 0.17.5. Daemon will fail to start.",
|
||||
Fix: "Run 'bd migrate --update-repo-id' to add fingerprint",
|
||||
}
|
||||
}
|
||||
@@ -458,13 +458,13 @@ func CheckRepoFingerprint(path string) DoctorCheck {
|
||||
}
|
||||
}
|
||||
|
||||
// If repo_id is empty, treat as legacy
|
||||
// If repo_id is empty, treat as legacy - this is an error because daemon won't start
|
||||
if storedRepoID == "" {
|
||||
return DoctorCheck{
|
||||
Name: "Repo Fingerprint",
|
||||
Status: StatusWarning,
|
||||
Status: StatusError,
|
||||
Message: "Legacy database (empty fingerprint)",
|
||||
Detail: "Database was created before version 0.17.5",
|
||||
Detail: "Database was created before version 0.17.5. Daemon will fail to start.",
|
||||
Fix: "Run 'bd migrate --update-repo-id' to add fingerprint",
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user