apache/hadoop · error

You must set the VECSUM_TYPE environment variable to libhdfs

Error message

You must set the VECSUM_TYPE environment variable to libhdfs, zcr, or local

What it means

vecsum is a libhdfs microbenchmark that is configured entirely through environment variables; VECSUM_TYPE selects the read backend it will measure. options_create() calls getenv("VECSUM_TYPE") and aborts the whole run when the variable is absent. This is a startup-time usage error printed before any file or network activity happens.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c:211

                (long long)VECSUM_CHUNK_SIZE, (long long)opts->length);
        goto error;
    }
    pass_str = getenv("VECSUM_PASSES");
    if (!pass_str) {
        fprintf(stderr, "You must set the VECSUM_PASSES environment "
            "variable to the number of passes to make.\n");
        goto error;
    }
    opts->passes = atoi(pass_str);
    if (opts->passes <= 0) {
        fprintf(stderr, "Invalid value for the VECSUM_PASSES "
            "environment variable.  You must set this to a "
            "number greater than 0.\n");
        goto error;
    }
    ty_str = getenv("VECSUM_TYPE");
    if (!ty_str) {
        fprintf(stderr, "You must set the VECSUM_TYPE environment "
            "variable to " VECSUM_TYPE_VALID_VALUES "\n");
        goto error;
    }
    ty = parse_vecsum_type(ty_str);
    if (ty < 0) {
        fprintf(stderr, "Invalid VECSUM_TYPE environment variable.  "
            "Valid values are " VECSUM_TYPE_VALID_VALUES "\n");
        goto error;
    }
    opts->ty = ty;
    opts->rpc_address = getenv("VECSUM_RPC_ADDRESS");
    if (!opts->rpc_address) {
        opts->rpc_address = "default";
    }
    return opts;
error:
    free(opts);
    return NULL;

View on GitHub (pinned to 2add963021)

Solutions

  1. Set and export VECSUM_TYPE to one of the three backends before running: export VECSUM_TYPE=libhdfs (or zcr, or local).
  2. If you believe it is set, verify it is actually exported to the child process: env | grep VECSUM — `VECSUM_TYPE=...` without `export` is invisible to vecsum.
  3. Put all required variables (VECSUM_PATH, VECSUM_PASSES, VECSUM_TYPE, optionally VECSUM_LENGTH and VECSUM_RPC_ADDRESS) in one launcher script so they cannot drift apart.
  4. Use VECSUM_TYPE=local for a first smoke test; it needs no HDFS cluster, only a writable local path.

Example fix

# before
./vecsum
# stderr: You must set the VECSUM_TYPE environment variable to libhdfs, zcr, or local

# after
export VECSUM_PATH=/bench/vecsum.dat
export VECSUM_PASSES=4
export VECSUM_TYPE=local   # or libhdfs / zcr
./vecsum
Defensive patterns

Strategy: validation

Validate before calling

#!/bin/sh
# fail fast before launching vecsum
: "${VECSUM_PATH:?set VECSUM_PATH}"
: "${VECSUM_PASSES:?set VECSUM_PASSES}"
case "$(printf '%s' "${VECSUM_TYPE:-}" | tr '[:upper:]' '[:lower:]')" in
  local|libhdfs|zcr) ;;
  *) echo "VECSUM_TYPE must be libhdfs, zcr, or local" >&2; exit 2 ;;
esac
exec ./vecsum

Prevention

When it happens

Trigger: Running the vecsum test binary (built from libhdfs-tests) with VECSUM_PATH and VECSUM_PASSES set (or unset) but VECSUM_TYPE missing from the environment. getenv returns NULL at vecsum.c:209, the message prints, options_create returns NULL, and main exits with status 1.

Common situations: Running vecsum from a fresh shell or CI job where the launcher script exported only some of the VECSUM_* variables; setting the variable with `VECSUM_TYPE=libhdfs ./vecsum` syntax that does not survive into a wrapper script; copy-pasting a run command from docs that omits this variable.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/adcd3d0f40cfe7ae. Report an issue: GitHub.