yeasy/docker-compose-files

Error when creating an new channel, "Got unexpected status: BAD_REQUEST"

tpasquet opened this issue · 46 comments

I'm getting one issue trying to create a new channel.
I run this command :
peer channel create -o orderer.example.com:7050 -c ${CHANNEL_NAME} -f ./peer/channel-artifacts/channel.tx
But i got this error "Error: Got unexpected status: BAD_REQUEST"
Do you know where did this come from ?
Thanks a lot !

From the orderer.example.com logs, i got :
" Rejecting CONFIG_UPDATE because: Error authorizing update: Error validating ReadSet: Readset expected key [Groups] /Channel/Application at version 0, but got version 1"

yeasy commented

Seems the channel is already created?

i met the same error.

yeasy commented

@bizhenchao1201 can u try with the latest steps?

what os/version are u using?

@yeasy Hello, I got an error saying "Error: Invalid channel create transaction : mismatched channel ID businesschannel != mychannel" when I tried to create "mychannel". Is this because I have already create a businesschannel? If so, how can I deleter bussinesschannel and create mychannel? Thank you in advance.

@RunshanHu yeah, because the configs in e2e/channel-artifacts has been re-generated with businesschannel, refer to this
second, channel can not be deleted, see peer channel --help, has no remove or delete

Don't forget to set *TLS_ENABLED to false in peer_base.yaml and orderer_base.yaml, cause some example under no-tls, distinguish them is to see whether there is --cafile $ORDERER_CA in command, hope can help you.

@yeasy you are right , channel is already created

I am also getting the same error, any update.

@akshay2218 Start with a fresh config and new channel name. Also, try passing the -t int flag in peer channel create command. Might be an issue that the command is timing before generating the channel genesis block.

Any idea ?

Error: Got unexpected status: BAD_REQUEST
Usage:
peer channel create [flags]

I'm getting one issue trying to create a new channel.
I run this command:
#node main.js

create mychannel......
error: [Orderer.js]: sendBroadcast - on error: "Error: Connect Failed\n at ClientDuplexStream._emitStatusIfDone (/opt/caliper/node_modules/grpc/src/client.js:255:19)\n at ClientDuplexStream._readsDone (/opt/caliper/node_modules/grpc/src/client.js:221:8)\n at readCallback (/opt/caliper/node_modules/grpc/src/client.js:283:12)"
not ok 1 Failed to create channels Error: SERVICE_UNAVAILABLE at ClientDuplexStream. (/opt/caliper/node_modules/fabric-client/lib/Orderer.js:128:21) at emitOne (events.js:96:13) at ClientDuplexStream.emit (events.js:188:7) at ClientDuplexStream._emitStatusIfDone (/opt/caliper/node_modules/grpc/src/client.js:258:12) at ClientDuplexStream._readsDone (/opt/caliper/node_modules/grpc/src/client.js:221:8) at readCallback (/opt/caliper/node_modules/grpc/src/client.js:283:12)

yeasy commented

@VemiReddyN guess u're using the node sdk, pls ask in chat.hyperledger.org/channel/fabric-sdk-node.
Thanks!

I had the same error because the channel was already started. If this is the case then try
./byfn.sh -m restart -c channelName

The error is due to the presence of a channel already with the name "mychannel".
When starting up the network we used the command:
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=10000 docker-compose -f docker-compose-cli.yaml -f docker-compose-couch.yaml up -d

If you check the docker-compose-cli.yaml file, for the CLI container the below command is present, which executes the script.
command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME} ${DELAY}; sleep $TIMEOUT'

Now this script creates the channel, installs the chaincode as well as instantiates the chaincode.
So if we run this script, we can directly query the database.

Hope this helps... :) :)

@jainandy I follow your solution but i still get error. first i use CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=10000 docker-compose -f docker-compose-cli.yaml -f docker-compose-couch.yaml up -d and continue Query from [http://hyperledger-fabric.readthedocs.io/en/master/build_network.html]. it showed error Error: Error endorsing query: rpc error: code = Unknown desc = Failed to deserialize creator identity, err MSP Org1MSP is unknown - <nil>.

@darapich16 ,The error says it cannot find the Org1MSP. I hope you have ran the configtxgen. Also you check if the permissions are granted properly.

in my case I forgot to specify those 4 environment variables from the docs page:

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
CORE_PEER_LOCALMSPID="Org1MSP"
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt

@tpasquet hey guy,have you fixed it now?I have the same error.

2018-03-26 18:22:44.116 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- error authorizing update: error validating ReadSet: readset expected key [Group] /Channel/Application at version 0, but got version 1
Usage:
peer channel create [flags]

./byfn.sh -m restart -c channelName
is right , 3Q for @fjbuusao

I am also getting a same kind of exception. If any one else has got the same and resolved it, req to pls share the resolution

2018-08-10 14:15:22.634 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- Consortium config value missing

you are right, channel of mychannel is already exists, peer channel list will join the channel again .

@corpsemxq

that error is due to your identity certificate. Check the orderer log, it will show you more info. In my case, it has indicated that I have specified wrong MSP's certificate.

[channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- error authorizing update: error validating ReadSet: readset expected key [Group] /Channel/Application at version 0, but got version 1
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========

I first brought it down and then up again and it worked for me -
./byfn.sh down
./byfn.sh up

...Rejecting broadcast of config message from 172.19.0.1:40846 because of error: error authorizing update: error validating DeltaSet: attempted to set key [Value] /Channel/Application/Org1MSP/AnchorPeers to version 1, but key does not exist
got the same error

If you've run the script properly at the beginning then everything was created and you are getting these error because of:

These steps describe the scenario in which script.sh is run by ‘./byfn.sh up’. Clean your network with ./byfn.sh down and ensure this command is active. Then use the same docker-compose prompt to launch your network again

@tpasquet hey guy,have you fixed it now?I have the same error.

@yeasy @tpasquet even i have same issue
iam trying to update using

peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org2MSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

2018-12-06 10:03:08.299 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- error authorizing update: error validating ReadSet: readset expected key [Group] /Channel/Application/Org2MSP at version 0, but got version 1

I successfully created the channel. But do not joining peer0 to the same channel . I just disable the TLS properties of orderer and peer, It working well. I set all environmental variables. But I get error every time.
Command: peer channel join -b mychannel.block

Error: 2018-12-07 12:04:55.565 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-12-07 12:04:55.565 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-12-07 12:04:55.566 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-12-07 12:04:55.566 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0AA9070A5C08011A0C08E7C3A9E00510...DC57D85DCE3F1A080A000A000A000A00
2018-12-07 12:04:55.566 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: C19B85B8498CD4E3607BC5D687412C9641B920A55BCB7746A80897C8AFBBD7C7
2018-12-07 12:04:55.567 UTC [grpc] Printf -> DEBU 006 transport: http2Client.notifyError got notified that the client transport was broken read tcp 192.168.240.17:40432->192.168.240.16:7051: read: connection reset by peer.
Error: proposal failed (err: rpc error: code = Unavailable desc = transport is closing)
2018-12-07 12:04:55.567 UTC [grpc] Printf -> DEBU 007 transport: http2Client.notifyError got notified that the client transport was broken read tcp 192.168.240.17:40434->192.168.240.16:7051: read: connection reset by peer.
2018-12-07 12:04:55.568 UTC [grpc] Printf -> DEBU 008 transport: http2Client.notifyError got notified that the client transport was broken read tcp 192.168.240.17:40436->192.168.240.16:7051: read: connection reset by peer.

NB: I use kafka based ordering service

Fabric: 1.1.0

Composer:0.19.16

node:8.11.3

Please give a suggestions, Thanks in advance.

I am also getting a same kind of exception. If any one else has got the same and resolved it, req to pls share the resolution

2018-08-10 14:15:22.634 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- Consortium config value missing

I have same error. Did you fix?

i restart the network with "bash byfn.sh -m restart -c mychannel", but it still can not work. The error is "because of error: error authorizing update: error validating ReadSet: readset expected key [Group] /Channel/Application/Org1MSP at version 0, but got version 1".

Hi guys, I'm experiencing a similar issue: i have detailed it here: https://stackoverflow.com/questions/57144745/cannot-create-channels-with-new-orgs-in-fabric-got-error-attempted-to-include

Can you please help me?

@nguoibanso25 thanks for replying, but i don't want to restart my network, just tweak the consortium of an already running network.

Hi @ayush-deqode you can follow below steps to add new organisation to consortium

$: peer channel fetch config config_block.pb -o orderer.example.com:7050
    -c testchainid

   $: configtxlator proto_decode --input config_block.pb --type common.Block | jq .data.data[0].payload.data.config > config.json

   $: jq -s '.[0] * {"channel_group":{"groups":{"Consortiums":{"groups": {"TestConsortium": {"groups": {"Org3MSP":.[1]}}}}}}}' config.json ./org3.json > modified_config.json

   $: configtxlator proto_encode --input config.json --type common.Config
    --output config.pb

   $: configtxlator proto_encode --input modified_config.json --type common.Config --output modified_config.pb

  $:  configtxlator compute_update --channel_id testchainid --original config.pb --updated modified_config.pb --output org_update.pb

   $: configtxlator proto_decode --input  org_update.pb --type common.ConfigUpdate | jq . > org_update.json

  $:  echo '{"payload":{"header":{"channel_header":{"channel_id":"testchainid", "type":2}},"data":{"config_update":'$(cat org_update.json)'}}}' | jq . > org_update_in_envelope.json

   $: configtxlator proto_encode --input org_update_in_envelope.json --type common.Envelope --output org_update_in_envelope.pb

   $: peer channel signconfigtx -f org_update_in_envelope.pb

   $: peer channel update -f org_update_in_envelope.pb -c testchainid -o orderer.example.com:7050

@mdxooa it works, thank you so much!

Don't forget to set *TLS_ENABLED to false in peer_base.yaml and orderer_base.yaml, cause some example under no-tls, distinguish them is to see whether there is --cafile $ORDERER_CA in command, hope can help you.

qiang i have a confusion .
can you explain that why we do TLS disabled .and if do not disable then what consequence will happen .and if modify to false then what sort of benefits will be i get.

I had the same error because the channel was already started. If this is the case then try
./byfn.sh -m restart -c channelName

Thank you!I have solved this problem by your method

i tried set up hyperledger fabric with multiple hosts and i stoped containers and remove it after i tested my fabric. i met this question when i restart my fabric(i tried create a new channel and channel name is same as the last time), jbuusao works,and i read the byfn.sh in vim,and i found when you exec "byfn.sh down" the sh would remove some volumes in docker,so i tried exec "docker volume prune" and found the channel and chaincode was delete,you may test in your situation,it may work.
(ps. hope you can understand my suggestion,cause my english is poor)

i tried set up hyperledger fabric with multiple hosts and i stoped containers and remove it after i tested my fabric. i met this question when i restart my fabric(i tried create a new channel and channel name is same as the last time), jbuusao works,and i read the byfn.sh in vim,and i found when you exec "byfn.sh down" the sh would remove some volumes in docker,so i tried exec "docker volume prune" and found the channel and chaincode was delete,you may test in your situation,it may work. (ps. hope you can understand my suggestion,cause my english is poor)

tq. this worked.

The channel already exists

I have this error when I wanted to enter the CLI with sudo docker exec -it cli bash in chaincode-docker-devmode. Error: got unexpected status: BAD_REQUEST -- error applying config update to existing channel 'myc': error authorizing update: error validating ReadSet: proposed update requires that key [Group] /Channel/Application be at version 0, but it is currently at version 1.
How can I fix this problem? Do these solutions work?:

./byfn.sh down
./byfn.sh up

./byfn.sh -m restart -c channelName

If Yes, from which directory to enter these commands? I started the dev-network with sudo docker-compose -f docker-compose-simple.yaml up.

Do you know how to stop the Hyperledger Fabric tools / cli from exiting? I always have this problem.

In my case, I shut down docker directly, not clearing the Fabric network firstly. After clearing the old Fabric network, the command works

channel should be already exists. first need to create channel and genesis block, in create-artifacts. After that you specify the channel location which you created in first place in create-channel artifacts. but after that creating channel with giving orderer IP and channel location gives the error.