{"record":{"id":"adcd3d0f40cfe7ae","repo":"apache/hadoop","slug":"you-must-set-the-vecsum-type-environment-variable","errorCode":null,"errorMessage":"You must set the VECSUM_TYPE environment variable to libhdfs, zcr, or local\n","messagePattern":"You must set the VECSUM_TYPE environment variable to libhdfs, zcr, or local\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c","lineNumber":211,"sourceCode":"                (long long)VECSUM_CHUNK_SIZE, (long long)opts->length);\n        goto error;\n    }\n    pass_str = getenv(\"VECSUM_PASSES\");\n    if (!pass_str) {\n        fprintf(stderr, \"You must set the VECSUM_PASSES environment \"\n            \"variable to the number of passes to make.\\n\");\n        goto error;\n    }\n    opts->passes = atoi(pass_str);\n    if (opts->passes <= 0) {\n        fprintf(stderr, \"Invalid value for the VECSUM_PASSES \"\n            \"environment variable.  You must set this to a \"\n            \"number greater than 0.\\n\");\n        goto error;\n    }\n    ty_str = getenv(\"VECSUM_TYPE\");\n    if (!ty_str) {\n        fprintf(stderr, \"You must set the VECSUM_TYPE environment \"\n            \"variable to \" VECSUM_TYPE_VALID_VALUES \"\\n\");\n        goto error;\n    }\n    ty = parse_vecsum_type(ty_str);\n    if (ty < 0) {\n        fprintf(stderr, \"Invalid VECSUM_TYPE environment variable.  \"\n            \"Valid values are \" VECSUM_TYPE_VALID_VALUES \"\\n\");\n        goto error;\n    }\n    opts->ty = ty;\n    opts->rpc_address = getenv(\"VECSUM_RPC_ADDRESS\");\n    if (!opts->rpc_address) {\n        opts->rpc_address = \"default\";\n    }\n    return opts;\nerror:\n    free(opts);\n    return NULL;","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/vecsum.c#L193-L229","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set and export VECSUM_TYPE to one of the three backends before running: export VECSUM_TYPE=libhdfs (or zcr, or local).","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.","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.","Use VECSUM_TYPE=local for a first smoke test; it needs no HDFS cluster, only a writable local path."],"exampleFix":"# before\n./vecsum\n# stderr: You must set the VECSUM_TYPE environment variable to libhdfs, zcr, or local\n\n# after\nexport VECSUM_PATH=/bench/vecsum.dat\nexport VECSUM_PASSES=4\nexport VECSUM_TYPE=local   # or libhdfs / zcr\n./vecsum","handlingStrategy":"validation","validationCode":"#!/bin/sh\n# fail fast before launching vecsum\n: \"${VECSUM_PATH:?set VECSUM_PATH}\"\n: \"${VECSUM_PASSES:?set VECSUM_PASSES}\"\ncase \"$(printf '%s' \"${VECSUM_TYPE:-}\" | tr '[:upper:]' '[:lower:]')\" in\n  local|libhdfs|zcr) ;;\n  *) echo \"VECSUM_TYPE must be libhdfs, zcr, or local\" >&2; exit 2 ;;\nesac\nexec ./vecsum","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep every VECSUM_* variable in one versioned launcher script; never type them ad hoc.","Always use `export` — plain `VAR=...` on one line does not reach a subprocess launched from a script.","For local, smoke-test the whole env block with VECSUM_TYPE=local before adding HDFS variables."],"tags":["environment-variable","configuration","vecsum","startup-validation"],"backgroundTag":"missing-env-var","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}