{"record":{"id":"e425f1c3ef497f3d","repo":"thedotmack/claude-mem","slug":"invalid-claude-mem-redis-port-value-expected-a","errorCode":null,"errorMessage":"Invalid CLAUDE_MEM_REDIS_PORT=${value}; expected a TCP port","messagePattern":"Invalid CLAUDE_MEM_REDIS_PORT=(.+?); expected a TCP port","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/server/queue/redis-config.ts","lineNumber":74,"sourceCode":"    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,\n    maxRetriesPerRequest: null,\n    connectTimeout: 1000,\n    lazyConnect: true,\n  };\n}\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/server/queue/redis-config.ts#L56-L92","documentation":"Thrown by parseRedisPort() when CLAUDE_MEM_REDIS_PORT does not parse to an integer in the range 1..65535. Validation is strict: non-numeric, zero, negative, >65535, or fractional values all fail. Port 0 is explicitly rejected.","triggerScenarios":"CLAUDE_MEM_REDIS_PORT is empty, a non-numeric string, 0, negative, >65535, or a float.","commonSituations":"Operator copies a URL-form port into the bare-port setting. A trailing space or unit (e.g. '6379/tcp'). A typo. The variable is unset where a port is required.","solutions":["Set CLAUDE_MEM_REDIS_PORT to a plain integer between 1 and 65535 (commonly 6379).","Strip any non-numeric suffix (e.g. '/tcp' from a Docker port spec).","If using a redis:// URL instead, prefer CLAUDE_MEM_REDIS_URL (the URL's port is parsed separately)."],"exampleFix":"// before: export CLAUDE_MEM_REDIS_PORT=6379/tcp\n// after: export CLAUDE_MEM_REDIS_PORT=6379","handlingStrategy":"validation","validationCode":"function resolveRedisPort(): number {\n  const port = Number.parseInt(process.env.CLAUDE_MEM_REDIS_PORT ?? '', 10);\n  if (!Number.isInteger(port) || port <= 0 || port > 65535) {\n    throw new Error('CLAUDE_MEM_REDIS_PORT must be an integer in 1..65535');\n  }\n  return port;\n}","typeGuard":"function isValidPort(v: string): boolean {\n  const n = Number.parseInt(v, 10);\n  return Number.isInteger(n) && n > 0 && n <= 65535 && String(n) === v.trim();\n}","tryCatchPattern":"try {\n  port = parseRedisPort(getQueueSetting('CLAUDE_MEM_REDIS_PORT'));\n} catch (error) {\n  console.error((error as Error).message);\n  process.exit(1);\n}","preventionTips":["Set CLAUDE_MEM_REDIS_PORT to a plain integer (e.g. 6379) with no suffixes.","Prefer CLAUDE_MEM_REDIS_URL when the port is already encoded in the URL."],"tags":["config","redis","env","validation","port"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}