{"record":{"id":"a08e209fb5aace2f","repo":"hyperledger/fabric","slug":"s-not-equal-newest-oldest-config-number","errorCode":null,"errorMessage":"'%s' not equal <newest|oldest|config|(number)>","messagePattern":"'(.+?)' not equal <newest\\|oldest\\|config\\|\\(number\\)>","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/osnadmin/main.go","lineNumber":155,"sourceCode":"\n\tswitch command {\n\tcase join.FullCommand():\n\t\tresp, err = osnadmin.Join(osnURL, marshaledConfigBlock, caCertPool, tlsClientCert)\n\tcase list.FullCommand():\n\t\tif *listChannelID != \"\" {\n\t\t\tresp, err = osnadmin.ListSingleChannel(osnURL, *listChannelID, caCertPool, tlsClientCert)\n\t\t\tbreak\n\t\t}\n\t\tresp, err = osnadmin.ListAllChannels(osnURL, caCertPool, tlsClientCert)\n\tcase remove.FullCommand():\n\t\tresp, err = osnadmin.Remove(osnURL, *removeChannelID, caCertPool, tlsClientCert)\n\tcase update.FullCommand():\n\t\tresp, err = osnadmin.Update(osnURL, marshaledConfigEnvelope, caCertPool, tlsClientCert, *tlsHandshakeTimeShift)\n\tcase fetch.FullCommand():\n\t\tif *fetchBlockID != \"newest\" && *fetchBlockID != \"oldest\" && *fetchBlockID != \"config\" {\n\t\t\t_, err = strconv.Atoi(*fetchBlockID)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", 1, fmt.Errorf(\"'%s' not equal <newest|oldest|config|(number)>\", *fetchBlockID)\n\t\t\t}\n\t\t}\n\t\tresp, err = osnadmin.Fetch(osnURL, *fetchChannelID, *fetchBlockID, caCertPool, tlsClientCert, *tlsHandshakeTimeShift1)\n\t}\n\tif err != nil {\n\t\treturn errorOutput(err), 1, nil\n\t}\n\n\tbodyBytes, err := readBodyBytes(resp.Body)\n\tif err != nil {\n\t\treturn errorOutput(err), 1, nil\n\t}\n\n\toutput, err = responseOutput(!*noStatus, resp.StatusCode, bodyBytes, *fetchOutputFile)\n\tif err != nil {\n\t\treturn errorOutput(err), 1, nil\n\t}\n","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/cmd/osnadmin/main.go#L137-L173","documentation":"osnadmin's fetch command only accepts --channelID block specifiers of 'newest', 'oldest', 'config', or a decimal number. Any other string fails the strconv.Atoi fallback and produces this error before any network call.","triggerScenarios":"`osnadmin channel fetch` invoked with --channelID values like 'latest', '0x5', '5 ', or a non-numeric block height string.","commonSituations":"Users familiar with 'latest' from other tools type 'latest' instead of 'newest'; whitespace or quotes accidentally included in the flag value.","solutions":["Use one of the exact keywords: newest, oldest, or config.","Provide a plain decimal block number (e.g. 5).","Trim whitespace/quotes from the flag value.","Check `osnadmin channel fetch --help` for accepted values."],"exampleFix":"// before\nosnadmin channel fetch latest --channelID mychannel -o orderer:9443\n// after\nosnadmin channel fetch newest --channelID mychannel -o orderer:9443","handlingStrategy":"validation","validationCode":"func validFetchTarget(v string) bool {\n    switch v {\n    case \"newest\", \"oldest\", \"config\":\n        return true\n    }\n    _, err := strconv.Atoi(v)\n    return err == nil\n}\n// call before: if !validFetchTarget(fetchBlockID) { ... }","typeGuard":"func isFetchKeyword(v string) bool {\n    return v == \"newest\" || v == \"oldest\" || v == \"config\"\n}","tryCatchPattern":"if err := runOsnadmin(); err != nil {\n    if strings.Contains(err.Error(), \"not equal <newest|oldest|config|(number)>\") {\n        log.Fatalf(\"invalid fetch target %q: use newest|oldest|config|number\", err)\n    }\n}","preventionTips":["Validate the block specifier before invoking fetch.","Use only documented keywords: newest, oldest, config.","Quote numeric arguments to avoid shell interpolation surprises.","Trim whitespace from flag values in wrapper scripts."],"tags":["cli","validation","hyperledger-fabric"],"backgroundTag":"invalid-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"}