{"record":{"id":"999183a2fdab4259","repo":"hyperledger/fabric","slug":"ordering-service-endpoint-s-is-not-valid-or-missi","errorCode":null,"errorMessage":"ordering service endpoint %s is not valid or missing","messagePattern":"ordering service endpoint (.+?) is not valid or missing","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/channel/channel.go","lineNumber":173,"sourceCode":"\t\t// \"peer.tls.rootcert.file\"\n\t\tcf.EndorserClient, err = common.GetEndorserClientFnc(common.UndefinedParamValue, common.UndefinedParamValue)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithMessage(err, \"error getting endorser client for channel\")\n\t\t}\n\t}\n\n\t// for fetching blocks from a peer\n\tif isPeerDeliverRequired {\n\t\tcf.DeliverClient, err = common.NewDeliverClientForPeer(channelID, cf.Signer, bestEffort)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithMessage(err, \"error getting deliver client for channel\")\n\t\t}\n\t}\n\n\t// for create and fetch, we need the orderer as well\n\tif isOrdererRequired {\n\t\tif len(strings.Split(common.OrderingEndpoint, \":\")) != 2 {\n\t\t\treturn nil, errors.Errorf(\"ordering service endpoint %s is not valid or missing\", common.OrderingEndpoint)\n\t\t}\n\t\tcf.DeliverClient, err = common.NewDeliverClientForOrderer(channelID, cf.Signer, bestEffort)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tlogger.Infof(\"Endorser and orderer connections initialized\")\n\treturn cf, nil\n}\n","sourceCodeStart":155,"sourceCodeEnd":184,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/channel/channel.go#L155-L184","documentation":"For commands that need to talk to the ordering service (create/fetch), InitCmdFactory validates the ordering endpoint as host:port. If the configured ordering endpoint does not split into exactly two colon-separated parts, it is malformed or missing and the command cannot establish a deliver connection to the orderer.","triggerScenarios":"Running `peer channel create` or `peer channel fetch` without -o/--orderer, or with a malformed value like 'orderer.example.com' (no port) or 'orderer:7050:extra'.","commonSituations":"Omitting -o in scripts; port dropped when templating configs; YAML/env variable interpolation leaving the endpoint blank; IPv6 literal addresses not bracketed correctly.","solutions":["Pass a valid endpoint: peer channel create -o orderer.example.com:7050 ...","Check that the --orderer flag or ORDERER_CFG_PATH/env-driven config supplies both host and port.","Fix shell variables so they are not empty when interpolated into -o."],"exampleFix":"// before\npeer channel create -c mychannel -f mychannel.tx\n// after\npeer channel create -o orderer.example.com:7050 -c mychannel -f mychannel.tx","handlingStrategy":"validation","validationCode":"ORDERER=\"orderer.example.com:7050\"\nif [[ \"$ORDERER\" != *:* ]] || [[ \"$(echo \"$ORDERER\" | tr -cd ':' | wc -c)\" -ne 1 ]]; then\n  echo \"error: ordering endpoint must be host:port\" >&2; exit 1\nfi","typeGuard":"function isValidOrdererEndpoint(ep) {\n  const parts = ep.split(':');\n  return parts.length === 2 && parts[0].length > 0 && /^[0-9]+$/.test(parts[1]);\n}","tryCatchPattern":"cf, err := channel.InitCmdFactory(channel.EndorserNotRequired, channel.PeerDeliverNotRequired, channel.OrdererRequired)\nif err != nil {\n    return fmt.Errorf(\"check --orderer flag (host:port): %w\", err)\n}","preventionTips":["Always pass -o host:port for create/fetch commands.","Keep orderer endpoints in one config variable.","Validate endpoint format in wrapper scripts."],"tags":["network","fabric","orderer","configuration"],"backgroundTag":"invalid-endpoint","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"}