caddyserver/caddy · warning
no admin server
Error message
no admin server
What it means
stopAdminServer guards against being handed a nil *http.Server when shutting down the previous admin endpoint during a config change. In practice this is an internal invariant — the admin server pointer must exist to be stopped — and nil here indicates a bookkeeping bug or a custom embedder calling it with no server running.
Source
Thrown at admin.go:740
}
}
func adminPathAllowed(reqPath, allowedPath string) bool {
if allowedPath == "" || allowedPath == "/" {
return strings.HasPrefix(reqPath, allowedPath)
}
if reqPath == allowedPath {
return true
}
if strings.HasSuffix(allowedPath, "/") {
return strings.HasPrefix(reqPath, allowedPath)
}
return strings.HasPrefix(reqPath, allowedPath+"/")
}
func stopAdminServer(srv *http.Server) error {
if srv == nil {
return fmt.Errorf("no admin server")
}
timeout := 10 * time.Second
ctx, cancel := context.WithTimeoutCause(context.Background(), timeout, fmt.Errorf("stopping admin server: %ds timeout", int(timeout.Seconds())))
defer cancel()
err := srv.Shutdown(ctx)
if err != nil {
if cause := context.Cause(ctx); cause != nil && errors.Is(err, context.DeadlineExceeded) {
err = cause
}
return fmt.Errorf("shutting down admin server: %v", err)
}
Log().Named("admin").Info("stopped previous server", zap.String("address", srv.Addr))
return nil
}
// AdminRouter is a type which can return routes for the admin API.
type AdminRouter interface {
Routes() []AdminRouteView on GitHub (pinned to 50e54ee279)
Solutions
- If admin was disabled ('admin off'), keep it disabled across config changes or fully re-enable it rather than toggling mid-process
- Update to the latest Caddy patch release; nil-server shutdown paths have been hardened over time
- If reproducible on a stock binary, open an upstream bug with the config sequence
Defensive patterns
Strategy: try-catch
Prevention
- Avoid toggling 'admin off' and admin on/off across in-process config changes
- Report reproducible nil-server cases upstream with the config sequence
When it happens
Trigger: Caddy internals calling stopAdminServer(nil) during config replacement when no admin server was ever started (e.g. admin disabled via 'admin off' followed by a config that enables remote admin); library users invoking unexported paths via unsafe tricks.
Common situations: Configs mixing 'admin off' and later remote admin enabling in the same process; extremely rare with stock binaries — if seen, likely a bug worth reporting upstream.
Related errors
- no metrics registry found
- loading identity issuer modules: %s
- access control %d public key %d: parsing base64 certificate
- cannot enable remote admin without a certificate cache; conf
- no identifiers configured
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/fdbdb74f2dee14e1.
Report an issue: GitHub.