{"record":{"id":"1dcff8618bef4a2e","repo":"caddyserver/caddy","slug":"creating-storage-value-v","errorCode":null,"errorMessage":"creating storage value: %v","messagePattern":"creating storage value: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"caddy.go","lineNumber":548,"sourceCode":"\t}\n\n\t// create the new filesystem map\n\tnewCfg.fileSystems = &filesystems.FileSystemMap{}\n\n\t// prepare the new config for use\n\tnewCfg.apps = make(map[string]App)\n\tnewCfg.failedApps = make(map[string]error)\n\n\t// set up global storage and make it CertMagic's default storage, too\n\terr = func() error {\n\t\tif newCfg.StorageRaw != nil {\n\t\t\tval, err := ctx.LoadModule(newCfg, \"StorageRaw\")\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"loading storage module: %v\", err)\n\t\t\t}\n\t\t\tstor, err := val.(StorageConverter).CertMagicStorage()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"creating storage value: %v\", err)\n\t\t\t}\n\t\t\tnewCfg.storage = stor\n\t\t}\n\n\t\tif newCfg.storage == nil {\n\t\t\tnewCfg.storage = DefaultStorage\n\t\t}\n\t\tcertmagic.Default.Storage = newCfg.storage\n\n\t\treturn nil\n\t}()\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\t// start the admin endpoint (and stop any prior one)\n\tif replaceAdminServer {\n\t\terr = replaceLocalAdminServer(newCfg, ctx)","sourceCodeStart":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/caddy.go#L530-L566","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before: backend down\ncaddy run --config Caddyfile  # creating storage value: dial tcp ...:6379\n\n# after: start backend first\nredis-server --daemonize yes && caddy run --config Caddyfile","handlingStrategy":"retry","validationCode":"// Health-check the storage backend before Caddy loads the config.\nconn, err := net.DialTimeout(\"tcp\", storageEndpoint, 2*time.Second)\nif err != nil {\n    return fmt.Errorf(\"storage backend unreachable, load would fail: %w\", err)\n}\nconn.Close()","typeGuard":null,"tryCatchPattern":"for attempt := 1; attempt <= 3; attempt++ {\n    err := startCaddy(cfg)\n    if err == nil || !strings.Contains(err.Error(), \"creating storage value\") {\n        break\n    }\n    time.Sleep(time.Duration(attempt) * 5 * time.Second) // backend may still be booting\n}","preventionTips":["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."],"tags":["caddy","storage","certmagic","connection","modules"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}