redis/node-redis · error · Error
RE_FAULT_INJECTOR_URL environment variable must be set
Error message
RE_FAULT_INJECTOR_URL environment variable must be set
What it means
Thrown in the before hook of the Redis Enterprise cluster test describe block when the RE_FAULT_INJECTOR_URL environment variable is unset. That URL points at the fault injector HTTP service that resets and provisions the RE cluster (reset_cluster, then createAndSelectDatabase) before tests run. Without it, the harness cannot reach the fault injector to prepare the database.
Source
Thrown at packages/test-utils/lib/index.ts:1020
>(
title: string,
fn: (
cluster: RedisClusterType<M, F, S, RESP, TYPE_MAPPING>,
faultInjectorClient: IFaultInjectorClient
) => unknown,
options: REClusterTestOptions<M, F, S, RESP, TYPE_MAPPING>
) {
describe(title, function () {
let faultInjectorClient: FaultInjectorClient;
let dbConfig: DatabaseConfig;
before(async function () {
this.timeout(options.testTimeout ?? 300000);
const baseUrl = process.env.RE_FAULT_INJECTOR_URL;
if (!baseUrl) {
throw new Error("RE_FAULT_INJECTOR_URL environment variable must be set");
}
faultInjectorClient = new FaultInjectorClient(baseUrl);
await faultInjectorClient.triggerAction({
type: 'reset_cluster',
parameters: {
"clean_all_dbs": true,
"clean_maintenance_mode": true
}
})
const db = options.dbConfig ||
getCreateDatabaseConfig(
CreateDatabaseConfigType.CLUSTER,
options.dbName ?? `test-db-${Date.now()}`
);
View on GitHub (pinned to 90fd0652bc)
Solutions
- Start the fault injector service and export its URL: export RE_FAULT_INJECTOR_URL=http://127.0.0.1:<port> before running the suite.
- If you did not intend RE cluster mode, ensure RE_CLUSTER is unset or false so the suite uses local Docker servers instead.
- In CI, confirm the variable is exported into the test process's environment (not just a subshell) and is readable.
- Verify reachability with a curl to $RE_FAULT_INJECTOR_URL/stats before launching the tests.
Example fix
# before npm run test # RE_FAULT_INJECTOR_URL unset -> before() throws # after export RE_FAULT_INJECTOR_URL=http://127.0.0.1:20324 npm run test
Defensive patterns
Strategy: validation
Validate before calling
function assertFaultInjectorUrl(): string {
const url = process.env.RE_FAULT_INJECTOR_URL;
if (!url) {
throw new Error('Set RE_FAULT_INJECTOR_URL=<http://host:port> (fault injector service) before running RE cluster tests');
}
return url;
} Prevention
- Centralize the env check in a shared test bootstrap so every RE suite fails fast with one message.
- Document the required env vars (RE_CLUSTER, RE_FAULT_INJECTOR_URL, REDIS_ENDPOINTS_CONFIG_PATH) together in the repo's test README.
- In CI, assert the variable is present in a setup step before the test runner starts.
- curl the fault injector /stats endpoint in CI bootstrap to catch a wrong URL early.
When it happens
Trigger: Running a suite that uses the RE cluster describe helper (the testRECluster-style overload of TestUtils) without exporting RE_FAULT_INJECTOR_URL in the shell or CI environment.
Common situations: Running the RE cluster suite locally without the fault injector service running; CI did not propagate the env var or secret; typo in the variable name; invoking the wrong test entrypoint that assumes RE mode.
Related errors
- REDIS_ENDPOINTS_CONFIG_PATH must be set when RE_CLUSTER=true
- Database ${name} not found in ${path}
- No endpoints found for database ${name} in ${path}
- Invalid JSON configuration: ${error}
- Config file not found at path: ${path}
AI-assisted analysis of redis/node-redis@90fd0652bc (2026-08-11).
Data as JSON: /api/errors/0e4e087f84056f03.
Report an issue: GitHub.