caddyserver/caddy · error
creating storage value: %v
Error message
creating storage value: %v
What it means
After the storage module is loaded, its StorageConverter.CertMagicStorage() method constructs the underlying certmagic.Storage value. If that constructor fails (e.g. cannot reach the backend, cannot open a database), the error is wrapped as 'creating storage value'. This is distinct from 'loading storage module': the module was found and provisioned, but instantiating the backend connection failed.
Source
Thrown at caddy.go:548
}
// create the new filesystem map
newCfg.fileSystems = &filesystems.FileSystemMap{}
// prepare the new config for use
newCfg.apps = make(map[string]App)
newCfg.failedApps = make(map[string]error)
// set up global storage and make it CertMagic's default storage, too
err = func() error {
if newCfg.StorageRaw != nil {
val, err := ctx.LoadModule(newCfg, "StorageRaw")
if err != nil {
return fmt.Errorf("loading storage module: %v", err)
}
stor, err := val.(StorageConverter).CertMagicStorage()
if err != nil {
return fmt.Errorf("creating storage value: %v", err)
}
newCfg.storage = stor
}
if newCfg.storage == nil {
newCfg.storage = DefaultStorage
}
certmagic.Default.Storage = newCfg.storage
return nil
}()
if err != nil {
return ctx, err
}
// start the admin endpoint (and stop any prior one)
if replaceAdminServer {
err = replaceLocalAdminServer(newCfg, ctx)View on GitHub (pinned to 50e54ee279)
Solutions
- Verify the storage backend is reachable from Caddy's network namespace (curl/nc the endpoint).
- Fix credentials/endpoint in the storage module config per the plugin's docs.
- Bring the backend up, then reload the config; the failure is at connect time, so retry after fixing.
- If HA is not needed, drop the storage block to use the default local storage while debugging.
Example fix
# before: backend down caddy run --config Caddyfile # creating storage value: dial tcp ...:6379 # after: start backend first redis-server --daemonize yes && caddy run --config Caddyfile
Defensive patterns
Strategy: retry
Validate before calling
// Health-check the storage backend before Caddy loads the config.
conn, err := net.DialTimeout("tcp", storageEndpoint, 2*time.Second)
if err != nil {
return fmt.Errorf("storage backend unreachable, load would fail: %w", err)
}
conn.Close() Try / catch
for attempt := 1; attempt <= 3; attempt++ {
err := startCaddy(cfg)
if err == nil || !strings.Contains(err.Error(), "creating storage value") {
break
}
time.Sleep(time.Duration(attempt) * 5 * time.Second) // backend may still be booting
} Prevention
- Order services: storage backend before Caddy (systemd After=/Requires=).
- Keep storage credentials in env/secret managers referenced at deploy time, not stale files.
- Add readiness probes for the backend in container orchestration.
When it happens
Trigger: A storage plugin whose CertMagicStorage() dials its backend eagerly — Redis/etcd/Postgres plugins failing to connect, S3 plugins failing credential checks — while Caddy loads the config. Any admin config load or startup carrying that storage block reproduces it.
Common situations: Backend service down or firewalled when Caddy starts; wrong credentials/secrets; DNS for the storage endpoint failing in the container; TLS CA mismatch between Caddy and the storage backend.
Related errors
- loading storage module: %v
- creating storage configuration: %v
- WebSocket connections aren't allowed.
- Disabling same-origin restrictions is not allowed.
- Buggy browser is sending null Origin header.
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/1dcff8618bef4a2e.
Report an issue: GitHub.