hyperledger/fabric · error
'%s' not equal <newest|oldest|config|(number)>
Error message
'%s' not equal <newest|oldest|config|(number)>
What it means
When the block ID is non-empty but is not one of the accepted keywords and cannot be parsed as an integer, ValidateFetchBlockID rejects it with this formatted error echoing the offending value. It defines the full accepted grammar: newest|oldest|config|(number).
Source
Thrown at orderer/common/channelparticipation/validator.go:125
}
// ValidateFetchBlockID checks the block id. He can be: newest|oldest|config|(number)
func ValidateFetchBlockID(blockID string) error {
// Length
if len(blockID) <= 0 {
return errors.Errorf("block ID illegal, cannot be empty")
}
if blockID == "newest" || blockID == "oldest" || blockID == "config" {
return nil
}
_, err := strconv.Atoi(blockID)
if err == nil {
return nil
}
return errors.Errorf("'%s' not equal <newest|oldest|config|(number)>", blockID)
}
View on GitHub (pinned to 2736b63f8f)
Solutions
- Use exactly one of: newest, oldest, config, or a plain base-10 integer string.
- Trim the input of whitespace and strip quotes before sending.
- Convert hex/other bases to decimal first (e.g. printf '%d' 0x10 -> 16).
- Add client-side validation with strconv.Atoi plus keyword check so the request never goes out invalid.
Example fix
// before
fetchBlock("latest") // not accepted
// after
fetchBlock("newest") // or fetchBlock("42") Defensive patterns
Strategy: validation
Validate before calling
valid := func(id string) bool {
if id == "newest" || id == "oldest" || id == "config" { return true }
_, err := strconv.Atoi(strings.TrimSpace(id))
return err == nil
}
if !valid(blockID) { return fmt.Errorf("block ID %q must be newest|oldest|config|number", blockID) } Try / catch
if err := channelparticipation.ValidateFetchBlockID(blockID); err != nil {
// surface the server's formatted message listing accepted values
return err
} Prevention
- Trim whitespace and strip quotes from user input
- Convert hex/float inputs to plain base-10 integers first
- Enumerate the accepted keywords in UI dropdowns instead of free text
When it happens
Trigger: Calling the fetch-block API with values like 'last', 'latest', '0x10', '12.5', 'new ', '-1', or any typo of the keywords.
Common situations: Developers guessing the keyword set (using 'latest' instead of 'newest'); passing hex or float numbers; trailing whitespace or hidden characters from copy-paste; localization bugs.
Related errors
- block ID illegal, cannot be empty
- cannot enable channel capabilities without orderer support f
- Must set some OrdererAddresses
- failed computing orderer addresses
- orderer is required, but no ordering endpoint or endorser cl
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/ee0e4e490a6e7bf5.
Report an issue: GitHub.