caddyserver/caddy · error
reading input file
Error message
reading input file: %v
What it means
Wrapper around os.ReadFile/io.ReadAll failure in cmdAdaptConfig when loading the config input ('-' reads stdin). The error is a generic guard wrapping the underlying I/O error (missing file, permission denied, unreadable stdin); the offending input is the --config path.
Solutions
- Check that the input file exists and is readable, then verify the path passed to the command.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at cmd/commandfuncs.go:594 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/798d1b28d96b7d0a.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/commandfuncs.go:594
fmt.Errorf("adapter name is required (use --adapt flag or leave unspecified for default)")
}
cfgAdapter := caddyconfig.GetAdapter(adapterFlag)
if cfgAdapter == nil {
return caddy.ExitCodeFailedStartup,
fmt.Errorf("unrecognized config adapter: %s", adapterFlag)
}
var input []byte
// read from stdin if the file name is "-"
if configFlag == "-" {
input, err = io.ReadAll(os.Stdin)
} else {
input, err = os.ReadFile(configFlag)
}
if err != nil {
return caddy.ExitCodeFailedStartup,
fmt.Errorf("reading input file: %v", err)
}
opts := map[string]any{"filename": configFlag}
adaptedConfig, warnings, err := cfgAdapter.Adapt(input, opts)
if err != nil {
return caddy.ExitCodeFailedStartup, err
}
if prettyFlag {
var prettyBuf bytes.Buffer
err = json.Indent(&prettyBuf, adaptedConfig, "", "\t")
if err != nil {
return caddy.ExitCodeFailedStartup, err
}
adaptedConfig = prettyBuf.Bytes()
}
View on GitHub (pinned to 50e54ee279)