{"record":{"id":"7ef93d4b831ccf53","repo":"hyperledger/fabric","slug":"block-id-illegal-cannot-be-empty","errorCode":null,"errorMessage":"block ID illegal, cannot be empty","messagePattern":"block ID illegal, cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/common/channelparticipation/validator.go","lineNumber":113,"sourceCode":"\n\tconfigUpdateEnv, err := protoutil.EnvelopeToConfigUpdate(env)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tconfigUpdate, err := configtx.UnmarshalConfigUpdate(configUpdateEnv.ConfigUpdate)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn configUpdate.ChannelId, nil\n}\n\n// ValidateFetchBlockID checks the block id. He can be: newest|oldest|config|(number)\nfunc ValidateFetchBlockID(blockID string) error {\n\t// Length\n\tif len(blockID) <= 0 {\n\t\treturn errors.Errorf(\"block ID illegal, cannot be empty\")\n\t}\n\n\tif blockID == \"newest\" || blockID == \"oldest\" || blockID == \"config\" {\n\t\treturn nil\n\t}\n\n\t_, err := strconv.Atoi(blockID)\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\treturn errors.Errorf(\"'%s' not equal <newest|oldest|config|(number)>\", blockID)\n}\n","sourceCodeStart":95,"sourceCodeEnd":127,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/common/channelparticipation/validator.go#L95-L127","documentation":"ValidateFetchBlockID checks the block identifier given to the channel participation fetch-block endpoint. This error means the caller supplied an empty block ID string; valid IDs are 'newest', 'oldest', 'config', or a numeric block number.","triggerScenarios":"Calling GET /participation/v1/channels/{channel}/blocks with an empty path/query parameter, or invoking the CLI/SDK fetch helper without the blockID argument populated.","commonSituations":"Unset shell variable used as the block ID in a curl/CLI command; UI leaving the field blank; API client that omits an optional-looking parameter that is actually required.","solutions":["Supply a valid block ID: 'newest', 'oldest', 'config', or a non-negative integer (e.g. 0, 42).","Fix the shell script so the variable holding the block ID is not empty (add a default, e.g. blockID=${BLOCK_ID:-newest}).","Check the client library call signature — the block ID argument is mandatory, not optional.","URL-encode the path correctly so a literal value is delivered rather than an empty segment."],"exampleFix":"// before\ncurl .../channels/mychannel/blocks/$BLOCK_ID   # BLOCK_ID unset -> empty\n// after\nBLOCK_ID=${BLOCK_ID:-newest}\ncurl .../channels/mychannel/blocks/$BLOCK_ID","handlingStrategy":"validation","validationCode":"if blockID == \"\" {\n    return errors.New(\"block ID is required: newest|oldest|config|(number)\")\n}","typeGuard":null,"tryCatchPattern":"if err := channelparticipation.ValidateFetchBlockID(blockID); err != nil {\n    return fmt.Errorf(\"invalid block ID %q: %w\", blockID, err)\n}","preventionTips":["Default empty inputs to \"newest\" in scripts","Validate the block ID argument at CLI/SDK entry points","Check curl/URL templates for unset variables before sending"],"tags":["fabric","orderer","empty-argument","api"],"backgroundTag":"missing-required-argument","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"}