ethereum/go-ethereum · warning

./bench: unrecognized argument.\n\n

Error message

./bench: unrecognized argument.\n\n

What it means

This is the argument-validation failure of libsecp256k1's standalone bench tool: any command-line token that does not match the tool's allow-list (specific benchmark names plus flags like -h/--help) prints 'unrecognized argument' plus the help text and exits with EXIT_FAILURE. It is a usage error in the CLI wrapper, not a library failure.

Source

Thrown at crypto/secp256k1/libsecp256k1/src/bench.c:194

    int default_iters = 20000;
    int iters = get_iters(default_iters);

    /* Check for invalid user arguments */
    char* valid_args[] = {"ecdsa", "verify", "ecdsa_verify", "sign", "ecdsa_sign", "ecdh", "recover",
                         "ecdsa_recover", "schnorrsig", "schnorrsig_verify", "schnorrsig_sign", "ec",
                         "keygen", "ec_keygen", "ellswift", "encode", "ellswift_encode", "decode",
                         "ellswift_decode", "ellswift_keygen", "ellswift_ecdh"};
    size_t valid_args_size = sizeof(valid_args)/sizeof(valid_args[0]);
    int invalid_args = have_invalid_args(argc, argv, valid_args, valid_args_size);

    if (argc > 1) {
        if (have_flag(argc, argv, "-h")
           || have_flag(argc, argv, "--help")
           || have_flag(argc, argv, "help")) {
            help(default_iters);
            return EXIT_SUCCESS;
        } else if (invalid_args) {
            fprintf(stderr, "./bench: unrecognized argument.\n\n");
            help(default_iters);
            return EXIT_FAILURE;
        }
    }

/* Check if the user tries to benchmark optional module without building it */
#ifndef ENABLE_MODULE_ECDH
    if (have_flag(argc, argv, "ecdh")) {
        fprintf(stderr, "./bench: ECDH module not enabled.\n");
        fprintf(stderr, "Use ./configure --enable-module-ecdh.\n\n");
        return EXIT_FAILURE;
    }
#endif

#ifndef ENABLE_MODULE_RECOVERY
    if (have_flag(argc, argv, "recover") || have_flag(argc, argv, "ecdsa_recover")) {
        fprintf(stderr, "./bench: Public key recovery module not enabled.\n");
        fprintf(stderr, "Use ./configure --enable-module-recovery.\n\n");

View on GitHub (pinned to 6bb0588ad8)

Solutions

  1. Run './bench --help' to list the valid benchmark names for your exact vendored version
  2. Fix or remove the offending token in your script/Makefile
  3. Recheck after vendoring upgrades: benchmark sets change between libsecp256k1 releases

Example fix

# before
./bench ecdsa-sign   # hyphen not a valid name -> unrecognized argument

# after
./bench sign         # use the exact names from ./bench --help
Defensive patterns

Strategy: validation

Validate before calling

#!/bin/sh
# fail fast on bad args before running
for a in "$@"; do
  case "$a" in sign|verify|ecdh|recover|schnorrsig|ellswift) ;;
    *) echo "unknown bench arg: $a"; ./bench --help; exit 2 ;;
  esac
done
./bench "$@"

Prevention

When it happens

Trigger: Running ./bench with a typo'd or unsupported argument, e.g. './bench schnorr' on a build without that module, './bench --iters 100' if that flag is not in the valid list, or passing geth-style flags to the vendored binary.

Common situations: Developers building crypto/secp256k1's vendored bench from source and passing flags from a different libsecp256k1 version; CI scripts reusing old bench invocations after an upstream vendoring update removed a benchmark name.

Related errors


AI-assisted analysis of ethereum/go-ethereum@6bb0588ad8 (2026-08-15). Data as JSON: /api/errors/2a37a40a9df7683f. Report an issue: GitHub.