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

  1. Start the fault injector service and export its URL: export RE_FAULT_INJECTOR_URL=http://127.0.0.1:<port> before running the suite.
  2. If you did not intend RE cluster mode, ensure RE_CLUSTER is unset or false so the suite uses local Docker servers instead.
  3. In CI, confirm the variable is exported into the test process's environment (not just a subshell) and is readable.
  4. 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

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


AI-assisted analysis of redis/node-redis@90fd0652bc (2026-08-11). Data as JSON: /api/errors/0e4e087f84056f03. Report an issue: GitHub.