{"record":{"id":"7df719bfb70fcd63","repo":"hyperledger/fabric","slug":"error-loading-tls-key-s","errorCode":null,"errorMessage":"error loading TLS key (%s)","messagePattern":"error loading TLS key \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/peer/config.go","lineNumber":399,"sourceCode":"\t\t\t}\n\t\t}\n\t}\n\treturn \"\", errors.Errorf(\"no non-loopback, IPv4 interface detected\")\n}\n\n// GetServerConfig returns the gRPC server configuration for the peer\nfunc GetServerConfig() (comm.ServerConfig, error) {\n\tserverConfig := comm.ServerConfig{\n\t\tConnectionTimeout: viper.GetDuration(\"peer.connectiontimeout\"),\n\t\tSecOpts: comm.SecureOptions{\n\t\t\tUseTLS: viper.GetBool(\"peer.tls.enabled\"),\n\t\t},\n\t}\n\tif serverConfig.SecOpts.UseTLS {\n\t\t// get the certs from the file system\n\t\tserverKey, err := os.ReadFile(config.GetPath(\"peer.tls.key.file\"))\n\t\tif err != nil {\n\t\t\treturn serverConfig, fmt.Errorf(\"error loading TLS key (%s)\", err)\n\t\t}\n\t\tserverCert, err := os.ReadFile(config.GetPath(\"peer.tls.cert.file\"))\n\t\tif err != nil {\n\t\t\treturn serverConfig, fmt.Errorf(\"error loading TLS certificate (%s)\", err)\n\t\t}\n\t\tserverConfig.SecOpts.Certificate = serverCert\n\t\tserverConfig.SecOpts.Key = serverKey\n\t\tserverConfig.SecOpts.RequireClientCert = viper.GetBool(\"peer.tls.clientAuthRequired\")\n\t\tif serverConfig.SecOpts.RequireClientCert {\n\t\t\tvar clientRoots [][]byte\n\t\t\tfor _, file := range viper.GetStringSlice(\"peer.tls.clientRootCAs.files\") {\n\t\t\t\tclientRoot, err := os.ReadFile(\n\t\t\t\t\tconfig.TranslatePath(filepath.Dir(viper.ConfigFileUsed()), file),\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn serverConfig,\n\t\t\t\t\t\tfmt.Errorf(\"error loading client root CAs (%s)\", err)\n\t\t\t\t}","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/peer/config.go#L381-L417","documentation":"GetServerConfig enabled TLS but os.ReadFile failed on peer.tls.key.file — the TLS private key file path is missing, unreadable, or the file does not exist, so the gRPC server cannot be configured for TLS.","triggerScenarios":"Thrown at core/peer/config.go:399 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify peer.tls.key.file exists and is readable by the peer process","Fix the path in core.yaml and regenerate certs if missing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}