{"record":{"id":"2e8f960491676741","repo":"thedotmack/claude-mem","slug":"invalid-claude-mem-redis-mode-value-expected-e","errorCode":null,"errorMessage":"Invalid CLAUDE_MEM_REDIS_MODE=${value}; expected external, managed, or docker","messagePattern":"Invalid CLAUDE_MEM_REDIS_MODE=(.+?); expected external, managed, or docker","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/server/queue/redis-config.ts","lineNumber":68,"sourceCode":"function getQueueSetting(key: keyof SettingsDefaults): string {\n  if (process.env[key] !== undefined) {\n    return process.env[key]!;\n  }\n  if (existsSync(USER_SETTINGS_PATH)) {\n    const value = SettingsDefaultsManager.loadFromFile(USER_SETTINGS_PATH, false)[key];\n    if (value !== undefined) {\n      return value;\n    }\n  }\n  return SettingsDefaultsManager.get(key);\n}\n\nfunction normalizeRedisMode(value: string): RedisMode {\n  const normalized = value.trim().toLowerCase();\n  if (normalized === 'external' || normalized === 'managed' || normalized === 'docker') {\n    return normalized;\n  }\n  throw new Error(`Invalid CLAUDE_MEM_REDIS_MODE=${value}; expected external, managed, or docker`);\n}\n\nfunction parseRedisPort(value: string): number {\n  const port = Number.parseInt(value, 10);\n  if (!Number.isInteger(port) || port <= 0 || port > 65535) {\n    throw new Error(`Invalid CLAUDE_MEM_REDIS_PORT=${value}; expected a TCP port`);\n  }\n  return port;\n}\n\nfunction sanitizePrefix(value: string): string {\n  return (value.trim() || 'claude_mem').replace(/[^a-zA-Z0-9_-]/g, '_');\n}\n\nfunction connectionFromHost(host: string, port: number): RedisOptions {\n  return {\n    host,\n    port,","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/server/queue/redis-config.ts#L50-L86","documentation":"Thrown by normalizeRedisMode() when CLAUDE_MEM_REDIS_MODE (trimmed, lowercased) is not one of 'external', 'managed', or 'docker'. This classifies how Redis is provisioned for the bullmq queue. An empty/unset value also throws here, so the mode must be supplied whenever this function is reached.","triggerScenarios":"CLAUDE_MEM_REDIS_MODE is set to an invalid string (e.g. 'local', 'self-hosted', 'cloud'), or the function is called without the variable set.","commonSituations":"Operator invents a mode name. A stale config. The variable was expected to be optional but this code path requires it.","solutions":["Set CLAUDE_MEM_REDIS_MODE to 'external' (your own Redis), 'managed' (a managed Redis service), or 'docker' (Redis in the Docker stack).","Pick the value that matches your actual deployment topology.","If you don't use bullmq, ensure CLAUDE_MEM_QUEUE_ENGINE is sqlite so this path isn't hit."],"exampleFix":"// before: export CLAUDE_MEM_REDIS_MODE=local\n// after (self-hosted Redis): export CLAUDE_MEM_REDIS_MODE=external","handlingStrategy":"validation","validationCode":"const VALID_REDIS_MODES = new Set(['external', 'managed', 'docker']);\nfunction resolveRedisMode(): 'external' | 'managed' | 'docker' {\n  const v = (process.env.CLAUDE_MEM_REDIS_MODE ?? '').trim().toLowerCase();\n  if (!VALID_REDIS_MODES.has(v)) {\n    throw new Error('Set CLAUDE_MEM_REDIS_MODE to external, managed, or docker');\n  }\n  return v as 'external' | 'managed' | 'docker';\n}","typeGuard":"function isRedisMode(v: string): v is 'external' | 'managed' | 'docker' {\n  return v === 'external' || v === 'managed' || v === 'docker';\n}","tryCatchPattern":"try {\n  mode = normalizeRedisMode(getQueueSetting('CLAUDE_MEM_REDIS_MODE'));\n} catch (error) {\n  console.error((error as Error).message);\n  process.exit(1);\n}","preventionTips":["Document the three valid Redis modes and pick the one matching your topology.","If you don't use bullmq, set CLAUDE_MEM_QUEUE_ENGINE=sqlite so this path isn't reached."],"tags":["config","redis","env","validation"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}