{"record":{"id":"24ba229508dfadf9","repo":"hyperledger/fabric","slug":"peer-address-isn-t-set","errorCode":null,"errorMessage":"peer.address isn't set","messagePattern":"peer\\.address isn't set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"core/peer/config.go","lineNumber":341,"sourceCode":"\n\tc.MetricsProvider = viper.GetString(\"metrics.provider\")\n\tc.StatsdNetwork = viper.GetString(\"metrics.statsd.network\")\n\tc.StatsdAaddress = viper.GetString(\"metrics.statsd.address\")\n\tc.StatsdWriteInterval = viper.GetDuration(\"metrics.statsd.writeInterval\")\n\tc.StatsdPrefix = viper.GetString(\"metrics.statsd.prefix\")\n\n\tc.DockerCert = config.GetPath(\"vm.docker.tls.cert.file\")\n\tc.DockerKey = config.GetPath(\"vm.docker.tls.key.file\")\n\tc.DockerCA = config.GetPath(\"vm.docker.tls.ca.file\")\n\n\treturn nil\n}\n\n// getLocalAddress returns the address:port the local peer is operating on.  Affected by env:peer.addressAutoDetect\nfunc getLocalAddress() (string, error) {\n\tpeerAddress := viper.GetString(\"peer.address\")\n\tif peerAddress == \"\" {\n\t\treturn \"\", errors.New(\"peer.address isn't set\")\n\t}\n\thost, port, err := net.SplitHostPort(peerAddress)\n\tif err != nil {\n\t\treturn \"\", errors.Errorf(\"peer.address isn't in host:port format: %s\", peerAddress)\n\t}\n\n\tlocalIP, err := getLocalIP()\n\tif err != nil {\n\t\tpeerLogger.Errorf(\"local IP address not auto-detectable: %s\", err)\n\t\treturn \"\", err\n\t}\n\tautoDetectedIPAndPort := net.JoinHostPort(localIP, port)\n\tpeerLogger.Info(\"Auto-detected peer address:\", autoDetectedIPAndPort)\n\t// If host is the IPv4 address \"0.0.0.0\" or the IPv6 address \"::\",\n\t// then fallback to auto-detected address\n\tif ip := net.ParseIP(host); ip != nil && ip.IsUnspecified() {\n\t\tpeerLogger.Info(\"Host is\", host, \", falling back to auto-detected address:\", autoDetectedIPAndPort)\n\t\treturn autoDetectedIPAndPort, nil","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/peer/config.go#L323-L359","documentation":"getLocalAddress reads peer.address from configuration (viper, so env override CORE_PEER_ADDRESS also applies) to determine the address:port this peer advertises. If it is empty, load() fails with this error and the peer cannot start, because it must know its own reachable address. This is a required-configuration check.","triggerScenarios":"Starting a peer with neither peer.address set in core.yaml nor CORE_PEER_ADDRESS in the environment; an env-var override that resolves to an empty string; a mounted config file that omits the peer.address key.","commonSituations":"Docker/Kubernetes deployments where CORE_PEER_ADDRESS was dropped from the container env; docker-compose env files with a blank value; copying a minimal core.yaml without the address; secret/config mount ordering wiping environment variables.","solutions":["Set CORE_PEER_ADDRESS=peer0.org1.example.com:7051 (host:port) in the peer's environment and restart.","Alternatively set peer.address in core.yaml to a host:port value.","If peer.addressAutoDetect is desired, still ensure a sane default address is configured for the platform.","Inspect the container's effective env (docker inspect / kubectl exec env) to confirm the variable is not empty, then fix the compose/Helm values."],"exampleFix":"# before (docker-compose env)\nCORE_PEER_ADDRESS=\n# after\nCORE_PEER_ADDRESS=peer0.org1.example.com:7051","handlingStrategy":"validation","validationCode":"addr := os.Getenv(\"CORE_PEER_ADDRESS\")\nif addr == \"\" {\n    addr = viper.GetString(\"peer.address\")\n}\nif addr == \"\" {\n    return fmt.Errorf(\"peer.address (or CORE_PEER_ADDRESS) must be set as host:port\")\n}\nif _, _, err := net.SplitHostPort(addr); err != nil {\n    return fmt.Errorf(\"peer.address not in host:port format: %s\", addr)\n}","typeGuard":null,"tryCatchPattern":"if err := peer.Config(); err != nil {\n    if strings.Contains(err.Error(), \"peer.address isn't set\") {\n        return fmt.Errorf(\"set CORE_PEER_ADDRESS (e.g. peer0.org1.example.com:7051) before starting the peer: %w\", err)\n    }\n    return err\n}","preventionTips":["Always export CORE_PEER_ADDRESS in peer container environments and verify with 'env' inside the container.","Avoid blank values in .env/compose files; an empty value overrides core.yaml.","Add a preflight config check (host:port format) to peer startup scripts."],"tags":["config","fabric","env-var","network","startup"],"backgroundTag":"missing-env-var","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"}