gofr-dev/gofr · critical
status down
Error message
status down
What it means
errStatusDown is the sentinel error returned by the badger kv-store Client's HealthCheck when the embedded Badger database reports unhealthy status or the health check operation fails. Callers of the datasource health check receive this to signal the store is not currently usable.
Source
Thrown at pkg/gofr/datasource/kv-store/badger/badger.go:15
package badger
import (
"context"
"errors"
"fmt"
"strings"
"time"
"github.com/dgraph-io/badger/v4"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
)
var errStatusDown = errors.New("status down")
type Configs struct {
DirPath string
}
type Client struct {
db *badger.DB
configs *Configs
logger Logger
metrics Metrics
tracer trace.Tracer
}
func New(configs Configs) *Client {
return &Client{configs: &configs}
}
// UseLogger sets the logger for the BadgerDB client which asserts the Logger interface.View on GitHub (pinned to 187eb24962)
Solutions
- Verify DirPath exists, is writable, and is not locked by another process
- Check disk space and permissions
- Reopen/rebuild the Badger database if corrupted; restart the app
- Check errors.Is(err, errStatusDown) and alert/skip dependent calls
Example fix
// before
h := store.HealthCheck(ctx) // status down
// after
if err != nil {
logger.Errorf("badger down: %v", err)
// verify DirPath & lock, then restart store
} Defensive patterns
Strategy: retry
Validate before calling
if _, err := os.Stat(dirPath); err != nil {
return fmt.Errorf("badger dir unavailable: %w", err)
} Type guard
func isStatusDown(err error) bool {
return errors.Is(err, ErrStatusDown) || err != nil && err.Error() == "status down"
} Try / catch
if err := store.HealthCheck(ctx); err != nil {
logger.Errorf("badger status down: %v", err)
// verify DirPath/lock, restart, then retry with backoff
} Prevention
- Ensure only one process opens the Badger directory
- Monitor disk space and permissions on DirPath
- Never use the store after Close without reopening
- Alert on health check failures
When it happens
Trigger: HealthCheck(ctx) when Badger's internal check errors — e.g. DB closed, corrupted LSM/MANIFEST, disk I/O failure, or locked directory.
Common situations: Two processes opening the same Badger directory (file lock); disk full or permission denied on DirPath; calling HealthCheck after Close(); corrupt database after crash.
Related errors
- influxdb health check failed
- client not connected, call Connect() first
- jStream error
- errFileNotOpenForReading
- response retrieved is nil
AI-assisted analysis of gofr-dev/gofr@187eb24962 (2026-09-01).
Data as JSON: /api/errors/5f532baa2ce1e8eb.
Report an issue: GitHub.