caddyserver/caddy · error
generating random confirmation bytes: %v
Error message
generating random confirmation bytes: %v
What it means
Returned by `caddy start` when crypto/rand.Read fails while generating the 32 random confirmation bytes for the parent-child handshake. Go documents rand.Read as never failing on supported platforms (it panics on unsupported ones), so encountering this error is exceptional — it indicates a broken system entropy source in a custom build or unusual platform.
Source
Thrown at cmd/commandfuncs.go:111
cmd.Args = append(cmd.Args, "--watch")
}
if pidfileFlag != "" {
cmd.Args = append(cmd.Args, "--pidfile", pidfileFlag)
}
stdinPipe, err := cmd.StdinPipe()
if err != nil {
return caddy.ExitCodeFailedStartup,
fmt.Errorf("creating stdin pipe: %v", err)
}
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
// generate the random bytes we'll send to the child process
expect := make([]byte, 32)
_, err = rand.Read(expect)
if err != nil {
return caddy.ExitCodeFailedStartup,
fmt.Errorf("generating random confirmation bytes: %v", err)
}
// begin writing the confirmation bytes to the child's
// stdin; use a goroutine since the child hasn't been
// started yet, and writing synchronously would result
// in a deadlock
go func() {
_, _ = stdinPipe.Write(expect)
stdinPipe.Close()
}()
// start the process
err = cmd.Start()
if err != nil {
return caddy.ExitCodeFailedStartup,
fmt.Errorf("starting caddy process: %v", err)
}
View on GitHub (pinned to 50e54ee279)
Solutions
- Verify entropy availability: cat /proc/sys/kernel/random/entropy_stat on Linux
- Upgrade the Go toolchain used to build Caddy (modern rand.Read cannot return an error)
- Run on a supported platform/kernel for the Go version in use
Defensive patterns
Strategy: fallback
Prevention
- Keep the Go toolchain and Caddy build current — rand.Read cannot fail on supported platforms
- On exotic kernels, verify getrandom(2) availability before deploying
When it happens
Trigger: Effectively unreachable with standard Go on Linux/macOS/Windows; conceivable on platforms where getrandom(2) is unavailable such as very old kernels or restricted sandboxes using Go versions predating the fallback chain.
Common situations: Near-zero incidence; would surface only on exotic kernels, gVisor-style sandboxes with blocked entropy syscalls, or heavily patched Go runtimes.
Related errors
- reading envfile flag: %v
- opening listener for success confirmation: %v
- creating stdin pipe: %v
- starting caddy process: %v
- caddy process exited with error: %v
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/c34f73e7f68c7c3c.
Report an issue: GitHub.