caddyserver/caddy · error

sending configuration to instance

Error message

sending configuration to instance: %v

What it means

During 'caddy reload', the HTTP POST of the new config to the running instance's /load admin endpoint failed (connection refused, non-2xx, timeout). The error from AdminAPIRequest is wrapped and the command exits with failure.

Solutions

  1. Ensure the Caddy instance is running and its admin endpoint is reachable, then retry the command.
  2. Check the wrapped error for connection or TLS problems.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at cmd/commandfuncs.go:408 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/1f4a2744e29babca. Report an issue: GitHub.

Appendix: source

Thrown at cmd/commandfuncs.go:408

	adminAddr, err := DetermineAdminAPIAddress(addressFlag, config, configFile, configAdapterFlag)
	if err != nil {
		return caddy.ExitCodeFailedStartup, fmt.Errorf("couldn't determine admin API address: %v", err)
	}

	// optionally force a config reload
	headers := make(http.Header)
	if forceFlag {
		headers.Set("Cache-Control", "must-revalidate")
	}
	// Provide the source file/adapter to the running process so it can
	// preserve its last-config knowledge if this reload came from the same source.
	headers.Set("Caddy-Config-Source-File", configFile)
	headers.Set("Caddy-Config-Source-Adapter", adapterUsed)

	resp, err := AdminAPIRequest(adminAddr, http.MethodPost, "/load", headers, bytes.NewReader(config))
	if err != nil {
		return caddy.ExitCodeFailedStartup, fmt.Errorf("sending configuration to instance: %v", err)
	}
	defer resp.Body.Close()

	return caddy.ExitCodeSuccess, nil
}

func cmdVersion(_ Flags) (int, error) {
	_, full := caddy.Version()
	fmt.Println(full)
	return caddy.ExitCodeSuccess, nil
}

func cmdBuildInfo(_ Flags) (int, error) {
	bi, ok := debug.ReadBuildInfo()
	if !ok {
		return caddy.ExitCodeFailedStartup, fmt.Errorf("no build information")
	}
	fmt.Println(bi)

View on GitHub (pinned to 50e54ee279)