{"record":{"id":"75633f14809b7e3c","repo":"hyperledger/fabric","slug":"must-supply-genesis-block-file","errorCode":null,"errorMessage":"Must supply genesis block file","messagePattern":"Must supply genesis block file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/channel/join.go","lineNumber":60,"sourceCode":"}\n\n// GBFileNotFoundErr genesis block file not found\ntype GBFileNotFoundErr string\n\nfunc (e GBFileNotFoundErr) Error() string {\n\treturn fmt.Sprintf(\"genesis block file not found %s\", string(e))\n}\n\n// ProposalFailedErr proposal failed\ntype ProposalFailedErr string\n\nfunc (e ProposalFailedErr) Error() string {\n\treturn fmt.Sprintf(\"proposal failed (err: %s)\", string(e))\n}\n\nfunc getJoinCCSpec() (*pb.ChaincodeSpec, error) {\n\tif genesisBlockPath == common.UndefinedParamValue {\n\t\treturn nil, errors.New(\"Must supply genesis block file\")\n\t}\n\n\tgb, err := os.ReadFile(genesisBlockPath)\n\tif err != nil {\n\t\treturn nil, GBFileNotFoundErr(err.Error())\n\t}\n\t// Build the spec\n\tinput := &pb.ChaincodeInput{Args: [][]byte{[]byte(cscc.JoinChain), gb}}\n\n\tspec := &pb.ChaincodeSpec{\n\t\tType:        pb.ChaincodeSpec_Type(pb.ChaincodeSpec_Type_value[\"GOLANG\"]),\n\t\tChaincodeId: &pb.ChaincodeID{Name: \"cscc\"},\n\t\tInput:       input,\n\t}\n\n\treturn spec, nil\n}\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/channel/join.go#L42-L78","documentation":"getJoinCCSpec requires the genesis block file path (--blockpath/-b) to be set; when it is the undefined empty value it returns this error before reading the file. The genesis block is needed to build the CSCC join proposal payload. Note this is distinct from the sibling check in join() that reports 'Must supply genesis block path'.","triggerScenarios":"Calling the internal getJoinCCSpec (via `peer channel join`) without providing --blockpath pointing to the channel genesis block file.","commonSituations":"Forgetting -b when joining a channel; pointing at a config-block file instead of the genesis block in scripts generated for a different flow; generating artifacts where mychannel.block was never created.","solutions":["Rerun `peer channel join -b ./channel-artifacts/mychannel.block` with a valid genesis block path.","Generate the genesis block if missing: `configtxgen -profile ... -outputBlock mychannel.block -channelID mychannel`.","Verify the file exists and is readable by the CLI user before joining."],"exampleFix":"// before\npeer channel join\n// after\npeer channel join -b ./channel-artifacts/mychannel.block","handlingStrategy":"validation","validationCode":"// bash\n: \"${GENESIS_BLOCK:?set -b / GENESIS_BLOCK before running}\"\n[ -r \"$GENESIS_BLOCK\" ] || { echo \"genesis block missing: $GENESIS_BLOCK\"; exit 1; }\npeer channel join -b \"$GENESIS_BLOCK\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass -b pointing to the channel genesis block (mychannel.block from configtxgen).","Check file existence/readability before join.","Keep channel-artifacts generation and join steps in the same scripted flow.","Distinguish genesis block (join) from config block (fetch/update) files."],"tags":["hyperledger-fabric","cli","missing-argument"],"backgroundTag":"missing-required-flag","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"}