hyperledger/fabric · error
Error reading configuration: %s
Error message
Error reading configuration: %s
What it means
localconfig.Load cannot read the orderer's configuration file. viperutil.New() is configured with SetConfigName("orderer") and ReadInConfig fails — the orderer.yaml file is missing, unreadable, or malformed at the locations searched (FABRIC_CFG_PATH etc.).
Source
Thrown at orderer/common/localconfig/config.go:252
// configCache stores marshalled bytes of config structures that produced from
// EnhancedExactUnmarshal. Cache key is the path of the configuration file that was used.
type configCache struct {
mutex sync.Mutex
cache map[string][]byte
}
var cache = &configCache{}
// Load will load the configuration and cache it on the first call; subsequent
// calls will return a clone of the configuration that was previously loaded.
func (c *configCache) load() (*TopLevel, error) {
var uconf TopLevel
config := viperutil.New()
config.SetConfigName("orderer")
if err := config.ReadInConfig(); err != nil {
return nil, fmt.Errorf("Error reading configuration: %s", err)
}
c.mutex.Lock()
defer c.mutex.Unlock()
serializedConf, ok := c.cache[config.ConfigFileUsed()]
if !ok {
err := config.EnhancedExactUnmarshal(&uconf)
if err != nil {
return nil, fmt.Errorf("Error unmarshalling config into struct: %s", err)
}
serializedConf, err = json.Marshal(uconf)
if err != nil {
return nil, err
}
if c.cache == nil {
c.cache = map[string][]byte{}View on GitHub (pinned to 2736b63f8f)
Solutions
- Set FABRIC_CFG_PATH (or run from the directory) so it contains a valid orderer.yaml, and restart the orderer.
- Validate orderer.yaml syntax (yaml lint) and fix the parse error reported in the wrapped message %s.
- Check file permissions/readability for the user running the orderer process.
- If using sample config, copy fabric/sampleconfig/orderer.yaml and adjust General/LocalMSP sections.
Example fix
// before export FABRIC_CFG_PATH=/etc/hyperledger/fabric # directory has no orderer.yaml // after export FABRIC_CFG_PATH=/etc/hyperledger/fabric # ensure $FABRIC_CFG_PATH/orderer.yaml exists and parses
Defensive patterns
Strategy: validation
Validate before calling
if _, err := os.Stat(filepath.Join(os.Getenv("FABRIC_CFG_PATH"), "orderer.yaml")); os.IsNotExist(err) { return errors.New("orderer.yaml missing in FABRIC_CFG_PATH") } Try / catch
if _, err := config.Load(); err != nil && strings.Contains(err.Error(), "Error reading configuration") { check FABRIC_CFG_PATH and orderer.yaml syntax } Prevention
- Always set FABRIC_CFG_PATH explicitly in containers/systemd units
- Mount orderer.yaml read-only into images
- Lint orderer.yaml after every edit
- Keep config files under version control
When it happens
Trigger: orderer startup calls config.Load, and config.ReadInConfig() errors because no orderer.yaml is found on the search paths, the file lacks read permission, or its syntax is invalid (bad YAML/JSON).
Common situations: FABRIC_CFG_PATH not set or pointing to a directory without orderer.yaml; Docker image run without mounting the config; typo in YAML producing a parse error; file permissions changed after deployment.
Understand the failure class
Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.
Related errors
- invalid external builder configuration, path attribute missi
- external builder at path %s has no name attribute
- peer.address isn't set
- failed computing orderer addresses
- Error unmarshalling config into struct: %s
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/8815317abb21dd2e.
Report an issue: GitHub.