{"record":{"id":"77552998319c86ae","repo":"hyperledger/fabric","slug":"orderer-is-required-but-no-ordering-endpoint-or-e","errorCode":null,"errorMessage":"orderer is required, but no ordering endpoint or endorser client supplied","messagePattern":"orderer is required, but no ordering endpoint or endorser client supplied","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/chaincode/common.go","lineNumber":412,"sourceCode":"\t\tif len(endorserClients) == 0 {\n\t\t\treturn nil, errors.New(\"no endorser clients retrieved - this might indicate a bug\")\n\t\t}\n\t}\n\tcertificate, err := common.GetClientCertificateFnc()\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"error getting client certificate\")\n\t}\n\n\tsigner, err := common.GetDefaultSignerFnc()\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"error getting default signer\")\n\t}\n\n\tvar broadcastClient common.BroadcastClient\n\tif isOrdererRequired {\n\t\tif len(common.OrderingEndpoint) == 0 {\n\t\t\tif len(endorserClients) == 0 {\n\t\t\t\treturn nil, errors.New(\"orderer is required, but no ordering endpoint or endorser client supplied\")\n\t\t\t}\n\t\t\tendorserClient := endorserClients[0]\n\n\t\t\torderingEndpoints, err := common.GetOrdererEndpointOfChainFnc(channelID, signer, endorserClient, cryptoProvider)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.WithMessagef(err, \"error getting channel (%s) orderer endpoint\", channelID)\n\t\t\t}\n\t\t\tif len(orderingEndpoints) == 0 {\n\t\t\t\treturn nil, errors.Errorf(\"no orderer endpoints retrieved for channel %s, pass orderer endpoint with -o flag instead\", channelID)\n\t\t\t}\n\t\t\tlogger.Infof(\"Retrieved channel (%s) orderer endpoint: %s\", channelID, orderingEndpoints[0])\n\t\t\t// override viper env\n\t\t\tviper.Set(\"orderer.address\", orderingEndpoints[0])\n\t\t}\n\n\t\tbroadcastClient, err = common.GetBroadcastClientFnc()\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithMessage(err, \"error getting broadcast client\")","sourceCodeStart":394,"sourceCodeEnd":430,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/chaincode/common.go#L394-L430","documentation":"When an orderer is required (invoke or query-with-orderer), InitCmdFactory needs either an explicit ordering endpoint (-o / --orderer) or an endorser client from which to discover the channel's orderer endpoints. If both are absent, it refuses to proceed with this error.","triggerScenarios":"Running `peer chaincode invoke` (isOrdererRequired=true) without the `-o/--orderer` flag, with common.OrderingEndpoint empty, and no endorser clients available (e.g. isEndorserRequired=false or no peers configured).","commonSituations":"Forgetting the -o flag in scripts; running query paths that skip endorser setup; CI environments missing ORDERER_ADDRESS env var; copying a query command and removing peer flags.","solutions":["Pass the orderer explicitly: add `-o orderer.example.com:7050` (plus --tls and --cafile if TLS is enabled)","Set the ORDERER_ADDRESS environment variable (and ORDERER_TLS_* vars as needed)","Ensure at least one --peerAddresses is supplied so an endorser client can be used for orderer-endpoint discovery"],"exampleFix":"// before\npeer chaincode invoke -C mychannel -n mycc -c '{...}'\n// after\npeer chaincode invoke -o orderer.example.com:7050 --tls --cafile /path/ca.pem -C mychannel -n mycc -c '{...}'","handlingStrategy":"validation","validationCode":"if os.Getenv(\"ORDERER_ADDRESS\") == \"\" && orderingEndpointFlag == \"\" {\n    return fmt.Errorf(\"orderer required: pass -o <host:port> or set ORDERER_ADDRESS\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include -o and TLS flags in invoke scripts","Set ORDERER_ADDRESS in deployment/CI environments","Never strip peer flags when templating query commands into invoke commands"],"tags":["fabric","peer-cli","orderer","missing-flag"],"backgroundTag":"missing-orderer-endpoints","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"}