caddyserver/caddy · error
unrecognized config adapter: %s
Error message
unrecognized config adapter: %s
What it means
The adapter name given via --adapter (or inferred) has no registered caddyconfig.Adapter in this binary. Stock Caddy ships the caddyfile adapter; other adapters exist only if compiled in as plugins.
Source
Thrown at cmd/main.go:206
} else {
// success reading default Caddyfile
configFile = "Caddyfile"
logger.Info("using adjacent Caddyfile")
}
}
}
if yes, err := isCaddyfile(configFile, adapterName); yes {
adapterName = "caddyfile"
} else if err != nil {
return nil, "", "", err
}
// load config adapter
if adapterName != "" {
cfgAdapter = caddyconfig.GetAdapter(adapterName)
if cfgAdapter == nil {
return nil, "", "", fmt.Errorf("unrecognized config adapter: %s", adapterName)
}
}
// adapt config
if cfgAdapter != nil {
adaptedConfig, warnings, err := cfgAdapter.Adapt(config, map[string]any{
"filename": configFile,
})
if err != nil {
return nil, "", "", fmt.Errorf("adapting config using %s: %v", adapterName, err)
}
logger.Info("adapted config to JSON", zap.String("adapter", adapterName))
for _, warn := range warnings {
msg := warn.Message
if warn.Directive != "" {
msg = fmt.Sprintf("%s: %s", warn.Directive, warn.Message)
}
logger.Warn(msg,View on GitHub (pinned to 50e54ee279)
Solutions
- Check spelling: the built-in adapter is 'caddyfile'
- List what your binary supports; if the adapter is a plugin, rebuild with xcaddy including it
- Confirm which binary runs: which caddy && caddy version
Example fix
# before caddy adapt --config app.yaml --adapter yaml # unrecognized config adapter: yaml # after (build with the plugin, or use the built-in adapter) xcaddy build --with github.com/caddyserver/format-awslambda # example plugin flow caddy adapt --config Caddyfile --adapter caddyfile
Defensive patterns
Strategy: validation
Validate before calling
// Verify the adapter exists in this binary before using it:
if caddyconfig.GetAdapter(adapterName) == nil { return fmt.Errorf("adapter %q not compiled in; rebuild with xcaddy --with <plugin>", adapterName) } Type guard
func hasAdapter(name string) bool { return caddyconfig.GetAdapter(name) != nil } Prevention
- Standard builds only include the caddyfile adapter — others are plugins
- Pin and document xcaddy build flags alongside deployment scripts
- Verify with 'which caddy && caddy version' that the plugin-built binary is the one on PATH
When it happens
Trigger: Running 'caddy adapt --config x.yaml --adapter yaml' on a build without the yaml adapter plugin; misspelling 'caddyfile'; using an adapter plugin that was not compiled into the custom build actually being invoked.
Common situations: Custom xcaddy builds missing a plugin; docs referencing an adapter the installed binary lacks; PATH picking up a different caddy binary than the one built with the plugin.
Related errors
- unrecognized shell: %s
- cannot adapt config without config file (use --config)
- adapting config using %s: %v
- module %s is not a precompressor; is %T
- command short string is required
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/6682a0ea5fa7eb14.
Report an issue: GitHub.