{"record":{"id":"0b67a441357f6901","repo":"caddyserver/caddy","slug":"input-is-required","errorCode":null,"errorMessage":"--input is required","messagePattern":"--input is required","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/storagefuncs.go","lineNumber":72,"sourceCode":"\t\tvar jsonError *json.SyntaxError\n\t\tif errors.As(err, &jsonError) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn &tmpStruct, nil\n}\n\nfunc cmdImportStorage(fl Flags) (int, error) {\n\timportStorageCmdConfigFlag := fl.String(\"config\")\n\timportStorageCmdImportFile := fl.String(\"input\")\n\n\tif importStorageCmdConfigFlag == \"\" {\n\t\treturn caddy.ExitCodeFailedStartup, errors.New(\"--config is required\")\n\t}\n\tif importStorageCmdImportFile == \"\" {\n\t\treturn caddy.ExitCodeFailedStartup, errors.New(\"--input is required\")\n\t}\n\n\t// extract storage from config if possible\n\tstorageCfg, err := determineStorage(importStorageCmdConfigFlag, \"\")\n\tif err != nil {\n\t\treturn caddy.ExitCodeFailedStartup, err\n\t}\n\n\t// load specified storage or fallback to default\n\tvar stor certmagic.Storage\n\tctx, cancel := caddy.NewContext(caddy.Context{Context: context.Background()})\n\tdefer cancel()\n\tif storageCfg != nil && storageCfg.StorageRaw != nil {\n\t\tval, err := ctx.LoadModule(storageCfg, \"StorageRaw\")\n\t\tif err != nil {\n\t\t\treturn caddy.ExitCodeFailedStartup, err\n\t\t}\n\t\tstor, err = val.(caddy.StorageConverter).CertMagicStorage()","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/cmd/storagefuncs.go#L54-L90","documentation":"ECH Provision calls setConfigsFromStorage to load all persisted ECH configs from the 'ech/configs' storage prefix, and that load failed. This is the first read of ECH state after acquiring the exclusive 'ech_rotation' storage lock, so any storage List/Load failure surfaces here.","triggerScenarios":"storage.List(ctx, \"ech/configs\", false) or a subsequent per-config load fails: backend unavailable, permission denied, or one of the nested loads returned an unexpected error (the cleanup path in loadECHConfig already swallows per-config problems, so this is usually the List itself or a hard load failure).","commonSituations":"Remote storage outage at startup; data directory not readable; storage schema left in a bad state after an interrupted rotation; permissions changed under a running deployment.","solutions":["Check the wrapped error for the failing storage operation and backend.","Restore storage availability/read access and restart Caddy so Provision retries.","If local storage is corrupt, stop Caddy and remove the 'ech/configs' folder from the data directory — ECH configs will be regenerated (clients repick configs after DNS republish).","Ensure the same storage backend is shared consistently across cluster instances."],"exampleFix":"# before: unreadable ech data\nsudo ls /var/lib/caddy/ech/configs\n# after: reset ech state to force regeneration\nsystemctl stop caddy && rm -rf /var/lib/caddy/ech/configs && systemctl start caddy","handlingStrategy":"retry","validationCode":"// Pre-flight storage readability for ECH state:\nkeys, err := storage.List(ctx, \"ech/configs\", false)\nif err != nil { return fmt.Errorf(\"ech storage unreadable: %w\", err) }","typeGuard":null,"tryCatchPattern":"Fail startup loudly (the error already aborts TLS app provisioning), fix storage, restart; transient backend errors clear on retry.","preventionTips":["Keep the ech/configs prefix inside Caddy-managed storage only.","Monitor storage backend health before planned restarts.","Snapshot/reset ech state deliberately when migrating storage backends."],"tags":["caddy","caddytls","ech","storage","provisioning"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}