ipfs/kubo · warning
daemon is shutting down (started %s ago)
Error message
daemon is shutting down (started %s ago)
What it means
The `ipfs diag healthy` command fails fast when the daemon's shutdown sequence has already started: shutdown.StartedAt() is non-zero, so the command reports how long ago shutdown began and exits non-zero. This makes the command usable as a container healthcheck — a non-zero exit tells the orchestrator the node is going away.
Source
Thrown at core/commands/diag.go:56
"healthy": diagHealthyCmd,
},
}
// diagHealthyCmd is a container-healthcheck probe. It fails when shutdown
// has been initiated (even if the RPC API still answers) or when the DAG
// pipeline cannot resolve a built-in CID.
var diagHealthyCmd = &cmds.Command{
Helptext: cmds.HelpText{
Tagline: "Report whether the daemon is operational.",
ShortDescription: `
Exits 0 if the daemon is running and can resolve the well-known empty
UnixFS directory. Exits non-zero if shutdown has started or the DAG
pipeline is broken. Intended for container healthchecks.
`,
},
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
if t := shutdown.StartedAt(); !t.IsZero() {
return fmt.Errorf("daemon is shutting down (started %s ago)", time.Since(t).Round(time.Second))
}
api, err := cmdenv.GetApi(env, req)
if err != nil {
return err
}
probeCID, err := cid.Decode(diagHealthyProbeCIDStr)
if err != nil {
return fmt.Errorf("invalid probe CID: %w", err)
}
if _, _, err := api.ResolvePath(req.Context, path.FromCid(probeCID)); err != nil {
return fmt.Errorf("probe resolve: %w", err)
}
if _, err := api.Dag().Get(req.Context, probeCID); err != nil {
return fmt.Errorf("probe fetch: %w", err)
}
return cmds.EmitOnce(res, "ok")
},
}View on GitHub (pinned to 329838acdf)
Solutions
- Wait for the daemon to restart and retry the healthcheck
- Check `ipfs shutdown`/process lifecycle before probing
- Adjust healthcheck retry/grace periods to tolerate shutdown windows
Defensive patterns
Strategy: retry
Validate before calling
// before probing, check liveness
if t := shutdown.StartedAt(); !t.IsZero() { /* skip probe, node is shutting down */ } Try / catch
out, err := runCmd("ipfs diag healthy")
if err != nil && strings.Contains(err.Error(), "daemon is shutting down") { time.Sleep(gracePeriod); retry() } Prevention
- Configure healthchecks with retry counts and grace periods
- Treat non-zero `ipfs diag healthy` exit as 'unhealthy, shutting down' in orchestrators
When it happens
Trigger: Calling `ipfs diag healthy` (locally or via RPC) after `ipfs shutdown` or SIGTERM initiated graceful shutdown.
Common situations: Kubernetes/Docker healthcheck probes hitting a node that is mid-shutdown; scripts racing a daemon restart.
Related errors
- opening repo (is the daemon running?): %w
- 'ipfs id' cannot query information on remote peers without a
- ipfs api address could not be found
- cannot get migrations from unknown fetcher type
- nothing downloaded by ipfs fetcher
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/2163300aab282ab0.
Report an issue: GitHub.