{"record":{"id":"8815317abb21dd2e","repo":"hyperledger/fabric","slug":"error-reading-configuration-s-881531","errorCode":null,"errorMessage":"Error reading configuration: %s","messagePattern":"Error reading configuration: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/localconfig/config.go","lineNumber":252,"sourceCode":"// configCache stores marshalled bytes of config structures that produced from\n// EnhancedExactUnmarshal. Cache key is the path of the configuration file that was used.\ntype configCache struct {\n\tmutex sync.Mutex\n\tcache map[string][]byte\n}\n\nvar cache = &configCache{}\n\n// Load will load the configuration and cache it on the first call; subsequent\n// calls will return a clone of the configuration that was previously loaded.\nfunc (c *configCache) load() (*TopLevel, error) {\n\tvar uconf TopLevel\n\n\tconfig := viperutil.New()\n\tconfig.SetConfigName(\"orderer\")\n\n\tif err := config.ReadInConfig(); err != nil {\n\t\treturn nil, fmt.Errorf(\"Error reading configuration: %s\", err)\n\t}\n\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\tserializedConf, ok := c.cache[config.ConfigFileUsed()]\n\tif !ok {\n\t\terr := config.EnhancedExactUnmarshal(&uconf)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error unmarshalling config into struct: %s\", err)\n\t\t}\n\n\t\tserializedConf, err = json.Marshal(uconf)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif c.cache == nil {\n\t\t\tc.cache = map[string][]byte{}","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/localconfig/config.go#L234-L270","documentation":"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.).","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\nexport FABRIC_CFG_PATH=/etc/hyperledger/fabric   # directory has no orderer.yaml\n// after\nexport FABRIC_CFG_PATH=/etc/hyperledger/fabric   # ensure $FABRIC_CFG_PATH/orderer.yaml exists and parses","handlingStrategy":"validation","validationCode":"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\") }","typeGuard":null,"tryCatchPattern":"if _, err := config.Load(); err != nil && strings.Contains(err.Error(), \"Error reading configuration\") { check FABRIC_CFG_PATH and orderer.yaml syntax }","preventionTips":["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"],"tags":["orderer","fabric","config","startup"],"backgroundTag":"config-file-not-found","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}