{"record":{"id":"4cb66a0492f205df","repo":"thedotmack/claude-mem","slug":"claude-mem-queue-engine-is-not-bullmq","errorCode":null,"errorMessage":"CLAUDE_MEM_QUEUE_ENGINE is not \"bullmq\"","messagePattern":"CLAUDE_MEM_QUEUE_ENGINE is not \"bullmq\"","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/npx-cli/commands/server-jobs.ts","lineNumber":511,"sourceCode":"}> {\n  if (testSeams.openPool) return testSeams.openPool();\n  const { getSharedPostgresPool } = await import('../../storage/postgres/index.js');\n  const pool = getSharedPostgresPool({ requireDatabaseUrl: true });\n  return {\n    pool: pool as never,\n    releasePool: async () => { /* shared pool tears down on process exit */ },\n  };\n}\n\n// BullMQ access. Direct construction avoids importing the runtime, keeping\n// the CLI fast to boot. Returns counts per known queue name; gracefully\n// returns null when Redis is unconfigured.\nasync function collectBullmqCounts(): Promise<Record<string, { waiting: number; active: number; completed: number; failed: number; delayed: number; stalled: number }>> {\n  const { getRedisQueueConfig } = await import('../../server/queue/redis-config.js');\n  const { Queue } = await import('bullmq');\n  const config = getRedisQueueConfig();\n  if (config.engine !== 'bullmq') {\n    throw new Error('CLAUDE_MEM_QUEUE_ENGINE is not \"bullmq\"');\n  }\n  const { SERVER_JOB_QUEUE_NAMES } = await import('../../server/jobs/types.js');\n  const out: Record<string, { waiting: number; active: number; completed: number; failed: number; delayed: number; stalled: number }> = {};\n  for (const [kind, name] of Object.entries(SERVER_JOB_QUEUE_NAMES)) {\n    const queue = new Queue(name, { connection: config.connection, prefix: config.prefix });\n    try {\n      const counts = await queue.getJobCounts('waiting', 'active', 'completed', 'failed', 'delayed');\n      out[kind] = {\n        waiting: Number(counts.waiting ?? 0),\n        active: Number(counts.active ?? 0),\n        completed: Number(counts.completed ?? 0),\n        failed: Number(counts.failed ?? 0),\n        delayed: Number(counts.delayed ?? 0),\n        stalled: 0, // BullMQ rotates the stalled list; runtime tracks it via QueueEvents.\n      };\n    } finally {\n      await queue.close();\n    }","sourceCodeStart":493,"sourceCodeEnd":529,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/npx-cli/commands/server-jobs.ts#L493-L529","documentation":"collectBullmqCounts collects BullMQ queue depth statistics by connecting to Redis, but only makes sense when the queue engine is actually BullMQ. It throws this guard error when getRedisQueueConfig().engine is not 'bullmq', protecting against querying BullMQ queues on an installation configured for a different engine.","triggerScenarios":"Calling the server-jobs command (which invokes collectBullmqCounts) while CLAUDE_MEM_QUEUE_ENGINE (or equivalent config) resolves to a non-bullmq engine in getRedisQueueConfig().","commonSituations":"Developer switched the queue engine to a non-BullMQ implementation but still runs jobs-inspection tooling that assumes BullMQ; stale environment variable from an older setup.","solutions":["Set CLAUDE_MEM_QUEUE_ENGINE=bullmq in the environment or server config.","If you intentionally use another engine, use the job-count tooling that matches your engine instead of the BullMQ path.","Remove a stale CLAUDE_MEM_QUEUE_ENGINE value so the default engine is used."],"exampleFix":"// before\nCLAUDE_MEM_QUEUE_ENGINE=inline claude-mem server-jobs\n// after\nCLAUDE_MEM_QUEUE_ENGINE=bullmq claude-mem server-jobs","handlingStrategy":"validation","validationCode":"const config = await getRedisQueueConfig();\nif (config.engine !== 'bullmq') {\n  console.warn('Job-count tooling requires CLAUDE_MEM_QUEUE_ENGINE=bullmq');\n  return;\n}","typeGuard":"const isBullmq = (c: { engine: string }): c is { engine: 'bullmq' } => c.engine === 'bullmq';","tryCatchPattern":"try {\n  const counts = await collectBullmqCounts();\n} catch (e) {\n  if (String(e).includes('not \"bullmq\"')) {\n    console.error('Queue engine is not bullmq; use the matching jobs tooling.');\n  }\n}","preventionTips":["Keep CLAUDE_MEM_QUEUE_ENGINE consistent across environments (dotfiles, CI, containers).","Gate jobs-inspection UI/commands on the configured engine before calling them.","Document the env var in deployment configs."],"tags":["queue","bullmq","config"],"backgroundTag":"invalid-config-value","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}