{"record":{"id":"73c57b37a77f1a5d","repo":"thedotmack/claude-mem","slug":"claude-mem-redis-url-must-use-redis-or-rediss","errorCode":null,"errorMessage":"CLAUDE_MEM_REDIS_URL must use redis:// or rediss://","messagePattern":"CLAUDE_MEM_REDIS_URL must use redis:// or rediss://","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/server/queue/redis-config.ts","lineNumber":96,"sourceCode":"\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\nfunction connectionFromUrl(rawUrl: string): RedisOptions {\n  const parsed = new URL(rawUrl);\n  if (parsed.protocol !== 'redis:' && parsed.protocol !== 'rediss:') {\n    throw new Error('CLAUDE_MEM_REDIS_URL must use redis:// or rediss://');\n  }\n  const db = parsed.pathname.length > 1\n    ? Number.parseInt(parsed.pathname.slice(1), 10)\n    : undefined;\n  if (db !== undefined && (!Number.isInteger(db) || db < 0)) {\n    throw new Error(`Invalid Redis database in CLAUDE_MEM_REDIS_URL: ${parsed.pathname}`);\n  }\n  return {\n    host: parsed.hostname || '127.0.0.1',\n    port: parsed.port ? Number.parseInt(parsed.port, 10) : 6379,\n    username: parsed.username ? decodeURIComponent(parsed.username) : undefined,\n    password: parsed.password ? decodeURIComponent(parsed.password) : undefined,\n    db,\n    tls: parsed.protocol === 'rediss:' ? {} : undefined,\n    maxRetriesPerRequest: null,\n    connectTimeout: 1000,\n    lazyConnect: true,\n  };","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/server/queue/redis-config.ts#L78-L114","documentation":"Thrown by connectionFromUrl() when CLAUDE_MEM_REDIS_URL's URL protocol is neither 'redis:' nor 'rediss:'. The URL is parsed with the standard URL parser, so a malformed URL will instead throw a TypeError from `new URL()` before this check; this specific error is for a well-formed URL with the wrong scheme (e.g. http://, postgres://).","triggerScenarios":"CLAUDE_MEM_REDIS_URL is set with an http://, https://, or other non-Redis scheme; a copy-paste of a connection string from a different service.","commonSituations":"Operator pastes a Postgres/HTTP URL by mistake. A rediss:// URL was downgraded to https:// by a tool. A typo in the scheme.","solutions":["Use the redis:// scheme (or rediss:// for TLS-encrypted Redis).","For TLS, ensure the full URL is rediss://host:port and the Redis server presents a valid cert.","Double-check the string is the Redis connection URL and not another service's."],"exampleFix":"// before: export CLAUDE_MEM_REDIS_URL=https://redis.example.com:6379\n// after (TLS): export CLAUDE_MEM_REDIS_URL=rediss://redis.example.com:6379\n// after (plain): export CLAUDE_MEM_REDIS_URL=redis://127.0.0.1:6379","handlingStrategy":"validation","validationCode":"function assertRedisUrlScheme(rawUrl: string): void {\n  const parsed = new URL(rawUrl); // throws TypeError if malformed\n  if (parsed.protocol !== 'redis:' && parsed.protocol !== 'rediss:') {\n    throw new Error('CLAUDE_MEM_REDIS_URL must use redis:// or rediss://');\n  }\n}","typeGuard":"function isRedisSchemeUrl(rawUrl: string): boolean {\n  try {\n    const p = new URL(rawUrl).protocol;\n    return p === 'redis:' || p === 'rediss:';\n  } catch {\n    return false;\n  }\n}","tryCatchPattern":"try {\n  conn = connectionFromUrl(rawUrl);\n} catch (error) {\n  if (/must use redis:\\/\\/ or rediss:\\/\\//.test((error as Error).message)) {\n    console.error('Fix CLAUDE_MEM_REDIS_URL scheme to redis:// or rediss://');\n    process.exit(1);\n  }\n  throw error;\n}","preventionTips":["Always use redis:// (plain) or rediss:// (TLS) schemes for Redis URLs.","Validate the URL at startup before the queue tries to connect."],"tags":["config","redis","url","validation","tls"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}