apache/hadoop · error
Invalid VECSUM_TYPE environment variable. Valid values are
Error message
Invalid VECSUM_TYPE environment variable. Valid values are libhdfs, zcr, or local
What it means
vecsum read its VECSUM_TYPE setting but parse_vecsum_type() (vecsum.c:132) did not recognize the token, returning -1. Only the exact words local, libhdfs, and zcr are accepted, matched case-insensitively via strcasecmp. Any other spelling, extra whitespace, quoting artifact, or trailing newline makes the run abort at startup.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c:217
"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;
}
static int test_file_chunk_setup(double **chunk)
{
int i;
double *c, val;View on GitHub (pinned to 2add963021)
Solutions
- Use exactly one of the three tokens: export VECSUM_TYPE=libhdfs (case does not matter, spelling does).
- Print the value with delimiters to expose invisible characters: printf '[%s]\n' "$VECSUM_TYPE" — look for trailing spaces, CR, or newline.
- If the value comes from a file or pipeline, strip whitespace: export VECSUM_TYPE=$(tr -d '[:space:]\r\n' < /tmp/ty.txt).
- Check you are not running a different/older vecsum build whose accepted values differ from the ones in its own usage message.
Example fix
# before export VECSUM_TYPE="libhdfs " # trailing space → parse_vecsum_type returns -1 ./vecsum # after export VECSUM_TYPE=$(printf '%s' "libhdfs " | tr -d '[:space:]') ./vecsum
Defensive patterns
Strategy: validation
Validate before calling
# reject values vecsum's strcasecmp match will refuse
ty=$(printf '%s' "${VECSUM_TYPE:-}" | tr -d '[:space:]\r\n')
case "$ty" in
local|LOCAL|libhdfs|LIBHDFS|zcr|ZCR|lOcAl|LiBhDfS|ZcR) export VECSUM_TYPE="$ty" ;;
*) printf 'bad VECSUM_TYPE [%s] — use libhdfs, zcr, or local\n' "$ty" >&2; exit 2 ;;
esac Type guard
/* if you embed vecsum's option parsing, use an enum + validator */
enum vecsum_type { VECSUM_LOCAL = 0, VECSUM_LIBHDFS, VECSUM_ZCR };
static int valid_vecsum_type(const char *s) {
return strcasecmp(s, "local") == 0 ||
strcasecmp(s, "libhdfs") == 0 ||
strcasecmp(s, "zcr") == 0;
} Prevention
- Generate VECSUM_TYPE from a whitelist in scripts, never from free-form input.
- Strip whitespace/CR/LF from values read from files: tr -d '[:space:]\r\n'.
- On upgrades, re-check the valid list in the binary's own error message — it is the source of truth.
When it happens
Trigger: Exporting VECSUM_TYPE with a value outside {local, libhdfs, zcr}, e.g. VECSUM_TYPE=LOCAL works (strcasecmp) but VECSUM_TYPE="libhdfs " , VECSUM_TYPE=hdfs, VECSUM_TYPE=zcr\n (from a file read without chomp) or VECSUM_TYPE=LIBHDFS_V2 all fail parse_vecsum_type and hit the ty < 0 branch at vecsum.c:216.
Common situations: Scripts that generate VECSUM_TYPE dynamically and append whitespace or a newline; renaming a backend in a newer Hadoop version and running with the old name; typos like 'libhdfs' vs 'libhdfsplus'; values sourced from a config file with CRLF line endings.
Related errors
- You must set the VECSUM_TYPE environment variable to libhdfs
- Duration of a task shouldn't be less or equal to 0!
- No more entry in " + f
- f + " is a directory"
- f + " already exists"
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/43ddaeaf2dbc4b68.
Report an issue: GitHub.