{"record":{"id":"0e4e087f84056f03","repo":"redis/node-redis","slug":"re-fault-injector-url-environment-variable-must-be","errorCode":null,"errorMessage":"RE_FAULT_INJECTOR_URL environment variable must be set","messagePattern":"RE_FAULT_INJECTOR_URL environment variable must be set","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/test-utils/lib/index.ts","lineNumber":1020,"sourceCode":"  >(\n    title: string,\n    fn: (\n      cluster: RedisClusterType<M, F, S, RESP, TYPE_MAPPING>,\n      faultInjectorClient: IFaultInjectorClient\n    ) => unknown,\n    options: REClusterTestOptions<M, F, S, RESP, TYPE_MAPPING>\n  ) {\n    describe(title, function () {\n      let faultInjectorClient: FaultInjectorClient;\n      let dbConfig: DatabaseConfig;\n\n      before(async function () {\n        this.timeout(options.testTimeout ?? 300000);\n\n        const baseUrl = process.env.RE_FAULT_INJECTOR_URL;\n\n        if (!baseUrl) {\n          throw new Error(\"RE_FAULT_INJECTOR_URL environment variable must be set\");\n        }\n\n        faultInjectorClient = new FaultInjectorClient(baseUrl);\n\n        await faultInjectorClient.triggerAction({\n          type: 'reset_cluster',\n          parameters: {\n            \"clean_all_dbs\": true,\n            \"clean_maintenance_mode\": true\n          }\n        })\n\n        const db = options.dbConfig ||\n          getCreateDatabaseConfig(\n            CreateDatabaseConfigType.CLUSTER,\n            options.dbName ?? `test-db-${Date.now()}`\n          );\n","sourceCodeStart":1002,"sourceCodeEnd":1038,"githubUrl":"https://github.com/redis/node-redis/blob/90fd0652bc3f2a0a1b2f79fa9096b02a86b0ac58/packages/test-utils/lib/index.ts#L1002-L1038","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\n npm run test                           # RE_FAULT_INJECTOR_URL unset -> before() throws\n\n# after\n export RE_FAULT_INJECTOR_URL=http://127.0.0.1:20324\n npm run test","handlingStrategy":"validation","validationCode":"function assertFaultInjectorUrl(): string {\n  const url = process.env.RE_FAULT_INJECTOR_URL;\n  if (!url) {\n    throw new Error('Set RE_FAULT_INJECTOR_URL=<http://host:port> (fault injector service) before running RE cluster tests');\n  }\n  return url;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["test-utils","configuration","environment","redis-enterprise"],"backgroundTag":null,"analyzedSha":"90fd0652bc3f2a0a1b2f79fa9096b02a86b0ac58","analyzedAt":"2026-08-11T15:37:21.243Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}