{"record":{"id":"12e1744238a3d5d0","repo":"diegosouzapw/OmniRoute","slug":"redis-is-not-configured","errorCode":null,"errorMessage":"Redis is not configured","messagePattern":"Redis is not configured","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/shared/utils/rateLimiter.ts","lineNumber":68,"sourceCode":"  };\n}\n\nconst redisLogThrottle = createRedisLogThrottle();\n\n// Exposed for unit tests — returns a fresh, isolated throttle instance.\nexport function _createRedisLogThrottleForTests() {\n  return createRedisLogThrottle();\n}\n\n/**\n * Return the singleton Redis client, creating it (lazily importing `ioredis`)\n * on first call. Throws SYNCHRONOUSLY (not a rejected Promise) when Redis is\n * not configured — callers rely on this to fail fast without an `await`.\n * Otherwise returns a Promise that resolves once the client is constructed.\n */\nexport function getRedisClient(): Promise<Redis> {\n  if (!isRedisConfigured()) {\n    throw new Error(\"Redis is not configured\");\n  }\n\n  if (!redisClientPromise) {\n    redisClientPromise = (async () => {\n      // Lazy dynamic import — see the #6559 note above the singleton declaration.\n      const mod = await import(\"ioredis\");\n      const RedisCtor = (mod.default ?? mod) as typeof Redis;\n      const client = new RedisCtor(REDIS_URL, {\n        maxRetriesPerRequest: 3,\n        enableReadyCheck: false,\n        keyPrefix: REDIS_KEY_PREFIX,\n        retryStrategy(times) {\n          return Math.min(times * 50, 2000); // Exponential backoff\n        },\n      });\n      client.on(\"error\", (err) => {\n        // Throttle: log once per error-state change instead of on every retry (#4878).\n        if (redisLogThrottle.shouldLog(err.message)) {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/shared/utils/rateLimiter.ts#L50-L86","documentation":"Error \"Redis is not configured\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/shared/utils/rateLimiter.ts:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}