{"record":{"id":"80c09c607678c19e","repo":"hyperledger/fabric","slug":"channel-members-not-initialized","errorCode":null,"errorMessage":"channel members not initialized","messagePattern":"channel members not initialized","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/cluster/commauth.go","lineNumber":187,"sourceCode":"\n\t\tprobeConnection := func(conn *grpc.ClientConn) error {\n\t\t\tconnState := conn.GetState()\n\t\t\tif connState == connectivity.Connecting {\n\t\t\t\treturn errors.Errorf(\"connection to %d(%s) is in state %s\", stub.ID, stub.Endpoint, connState)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\tclusterClient := orderer.NewClusterNodeServiceClient(conn)\n\t\tgetStepClientStream := func(ctx context.Context) (StepClientStream, error) {\n\t\t\tstream, err := clusterClient.Step(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tmembersMapping, exists := ac.Chan2Members[channel]\n\t\t\tif !exists {\n\t\t\t\treturn nil, errors.Errorf(\"channel members not initialized\")\n\t\t\t}\n\t\t\tnodeStub := membersMapping.LookupByIdentity(ac.NodeIdentity)\n\t\t\tif nodeStub == nil {\n\t\t\t\treturn nil, errors.Errorf(\"node identity is missing in channel\")\n\t\t\t}\n\n\t\t\tstepClientStream := &NodeClientStream{\n\t\t\t\tVersion:           0,\n\t\t\t\tStepClient:        stream,\n\t\t\t\tSourceNodeID:      nodeStub.ID,\n\t\t\t\tDestinationNodeID: stub.ID,\n\t\t\t\tSigner:            ac.Signer,\n\t\t\t\tChannel:           channel,\n\t\t\t}\n\t\t\treturn stepClientStream, nil\n\t\t}\n\n\t\tworkerCountReporter := workerCountReporter{","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/cluster/commauth.go#L169-L205","documentation":"Inside getStepClientStream, after a gRPC Step stream is opened, the manager re-reads ac.Chan2Members[channel] to find its own identity's stub. This error means the channel mapping vanished (or was never present) at stream-creation time even though the stub was being activated - typically because the manager was shut down or the channel mapping was concurrently rebuilt.","triggerScenarios":"A Step stream is being created for a channel that is no longer (or not yet) in ac.Chan2Members: Shutdown() ran concurrently (Shutdown itself does not delete mappings, but a fresh AuthCommMgr with empty map was used), Configure was never called for this channel on this manager instance, or a config update replaced the mapping between Remote() and getStepClientStream execution.","commonSituations":"Orderer shutting down while streams are being created; channel removal/reconfiguration racing with stream creation; constructing AuthCommMgr with an empty Chan2Members and calling into stream paths without Configure; tests creating managers directly without populating membership.","solutions":["Ensure Configure(channel, members) has been called for the channel on this exact AuthCommMgr instance before establishing streams.","Check whether Shutdown() was invoked - after shutdown, no new streams should be attempted; wait for restart and reconfigure.","Look for concurrent config updates removing/recreating the channel mapping; serialize Configure with stream creation (the manager lock already guards, so audit external map access).","If seen in tests/custom wiring, initialize Chan2Members via Configure rather than an empty map literal."],"exampleFix":"// before\nmgr := &cluster.AuthCommMgr{} // Chan2Members empty\nstream, err := mgr.newStream(ctx, \"mychannel\")\n// after\nmgr.Configure(\"mychannel\", members)\nstream, err := mgr.newStream(ctx, \"mychannel\")","handlingStrategy":"validation","validationCode":"func membersInitialized(mgr *cluster.AuthCommMgr, channel string) bool {\n    mgr.Lock.RLock()\n    defer mgr.Lock.RUnlock()\n    _, ok := mgr.Chan2Members[channel]\n    return ok\n}\nif !membersInitialized(mgr, channel) {\n    mgr.Configure(channel, members) // initialize before streaming\n}","typeGuard":"func channelMappingPresent(mgr *cluster.AuthCommMgr, channel string) bool {\n    mgr.Lock.RLock()\n    defer mgr.Lock.RUnlock()\n    mapping, exists := mgr.Chan2Members[channel]\n    return exists && mapping != nil\n}","tryCatchPattern":"stream, err := getStream(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"channel members not initialized\") {\n        // membership mapping gone: likely shutdown or unconfigured channel; reconfigure and retry once\n        comm.Configure(channel, members)\n        stream, err = getStream(ctx)\n    }\n    return err\n}","preventionTips":["Never call stream-creating APIs on an AuthCommMgr before Configure() has populated its membership.","Check the shutdown flag before initiating streams during orderly shutdown.","Initialize Chan2Members through Configure, not by direct map assignment in tests/custom wiring.","Serialize channel removal/reconfiguration with stream creation to avoid the mapping disappearing mid-flight."],"tags":["hyperledger-fabric","orderer","stream","initialization"],"backgroundTag":"channel-members-not-initialized","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"}