OpenNHP/opennhp · error

config load error

Error message

config load error

What it means

A package-level sentinel error (errLoadConfig, mirrored in the ac package) used as a placeholder: updateBaseConfig and the etcd config watchers set it via CatchPanicThenRun so that a panic during config processing is converted into this generic 'config load error' return value. Seeing it means some deeper config-update operation panicked and was swallowed into this sentinel, not that a specific field failed validation.

Solutions

  1. Look for a preceding panic/stack in the logs to identify the real failing operation
  2. Enable debug logging around config updates to surface the panic cause
  3. Fix the underlying panic (usually malformed config content reaching a code path without nil/type checks)
  4. Keep the sentinel but add context wrapping so the original panic reason is preserved
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at endpoints/server/config.go:64 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of OpenNHP/opennhp@6e04ca5ff0 (2026-09-07). Data as JSON: /api/errors/d18d66ab2a98e645. Report an issue: GitHub.

Appendix: source

Thrown at endpoints/server/config.go:64

		return nil, fmt.Errorf("base64 decode failed: %w", err)
	}
	if len(raw) != 32 {
		return nil, fmt.Errorf("cookie signing key must be exactly 32 bytes after base64 decode, got %d", len(raw))
	}
	return raw, nil
}

var (
	baseConfigWatch  io.Closer
	httpConfigWatch  io.Closer
	acConfigWatch    io.Closer
	agentConfigWatch io.Closer
	resConfigWatch   io.Closer
	srcipConfigWatch io.Closer
	dbConfigWatch    io.Closer
	relayConfigWatch io.Closer
	teeWatch         io.Closer
	errLoadConfig    = fmt.Errorf("config load error")
)

type ServerEtcdConfig struct {
	BaseConfig    Config
	HttpConfig    HttpConfig
	ACs           []*core.UdpPeer
	Agents        []*core.UdpPeer
	DBs           []*core.UdpPeer
	AuthServiceId []*common.AuthServiceProviderData
	SrcIps        []*SrcIpMap
}

type SrcIpMap struct {
	SrcIp string
	Ip    []string
}

type Config struct {

View on GitHub (pinned to 6e04ca5ff0)