{"record":{"id":"4c380a5496e4353a","repo":"hyperledger/fabric","slug":"peer-s-doesn-t-have-associated-peer-config","errorCode":null,"errorMessage":"peer '%s' doesn't have associated peer config","messagePattern":"peer '(.+?)' doesn't have associated peer config","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/lifecycle/chaincode/client_connections.go","lineNumber":180,"sourceCode":"\t\treturn nil\n\t}\n\n\tfor peer, peerChannelConfig := range networkConfig.Channels[c.ChannelID].Peers {\n\t\tif peerChannelConfig.EndorsingPeer {\n\t\t\terr := c.appendPeerConfig(networkConfig, peer)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (c *ClientConnectionsInput) appendPeerConfig(n *common.NetworkConfig, peer string) error {\n\tpeerConfig, ok := n.Peers[peer]\n\tif !ok {\n\t\treturn errors.Errorf(\"peer '%s' doesn't have associated peer config\", peer)\n\t}\n\tc.PeerAddresses = append(c.PeerAddresses, peerConfig.URL)\n\tc.TLSRootCertFiles = append(c.TLSRootCertFiles, peerConfig.TLSCACerts.Path)\n\n\treturn nil\n}\n\nfunc (c *ClientConnections) setCertificate() error {\n\tcertificate, err := common.GetClientCertificate()\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"failed to retrieve client cerificate\")\n\t}\n\n\tc.Certificate = certificate\n\n\treturn nil\n}\n","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/lifecycle/chaincode/client_connections.go#L162-L198","documentation":"appendPeerConfig looks up the requested peer name in the connection profile's NetworkConfig.Peers map. This error means the peer name passed (via --targetPeer or a channel peer entry) does not exist in the loaded connection profile.","triggerScenarios":"--targetPeer value is not a key in the profile's \"peers\" section, or the channel-less lookup uses a name that doesn't match the YAML exactly.","commonSituations":"Typo or case mismatch between --targetPeer and the profile peer name; profile loaded is for a different organization/network than expected; stale profile missing a recently added peer.","solutions":["List the peers section of your connection profile and use an exact matching name for --targetPeer","Confirm the correct connection profile file is being loaded (check the path in --connectionProfile)","Fix spelling/case — profile peer keys are matched exactly"],"exampleFix":"// before\n--targetPeer peer0.orgX.example.com:7051   // not in cp.yaml\n// after\n--targetPeer peer0.org1.example.com:7051   // exact key from cp.yaml \"peers\"","handlingStrategy":"validation","validationCode":"cfg, _ := ccp.LoadConfig(profilePath)\nif _, ok := cfg.Peers[targetPeer]; !ok { return fmt.Errorf(\"peer %q not in connection profile\", targetPeer) }","typeGuard":"func peerInProfile(n *common.NetworkConfig, peer string) bool { _, ok := n.Peers[peer]; return ok }","tryCatchPattern":"if err := run(cmd); err != nil && strings.Contains(err.Error(), \"doesn't have associated peer config\") { log.Fatalf(\"peer %s missing from profile; check exact key spelling\", targetPeer) }","preventionTips":["Copy peer names exactly from the connection profile YAML","Keep one canonical profile per network and reference it consistently","Validate --targetPeer against the profile in scripts before invocation"],"tags":["fabric","connection-profile","configuration"],"backgroundTag":"peer-not-in-connection-profile","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"}