{"record":{"id":"15e9816ca387ef0f","repo":"Dokploy/dokploy","slug":"not-found-15e981","errorCode":"NOT_FOUND","errorMessage":"Redis not found","messagePattern":"Redis not found","errorType":"exception","errorClass":"TRPCError","httpStatus":404,"severity":"error","filePath":"packages/server/src/services/redis.ts","lineNumber":67,"sourceCode":"\n\treturn newRedis;\n};\n\nexport const findRedisById = async (redisId: string) => {\n\tconst result = await db.query.redis.findFirst({\n\t\twhere: eq(redis.redisId, redisId),\n\t\twith: {\n\t\t\tenvironment: {\n\t\t\t\twith: {\n\t\t\t\t\tproject: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\tmounts: true,\n\t\t\tserver: true,\n\t\t},\n\t});\n\tif (!result) {\n\t\tthrow new TRPCError({\n\t\t\tcode: \"NOT_FOUND\",\n\t\t\tmessage: \"Redis not found\",\n\t\t});\n\t}\n\treturn result;\n};\n\nexport const updateRedisById = async (\n\tredisId: string,\n\tredisData: Partial<Redis>,\n) => {\n\tconst { appName, ...rest } = redisData;\n\tconst result = await db\n\t\t.update(redis)\n\t\t.set({\n\t\t\t...rest,\n\t\t})\n\t\t.where(eq(redis.redisId, redisId))","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/packages/server/src/services/redis.ts#L49-L85","documentation":"findRedisById queries the `redis` table (with environment->project, mounts, server relations) by redisId and throws a NOT_FOUND TRPCError when drizzle's findFirst returns undefined. This is the standard Dokploy pattern for lookups: any tRPC procedure that resolves a redisId (e.g. the `redis` router queries, deployRedis) funnels through this check.","triggerScenarios":"Passing a redisId that does not exist, was deleted (removeRedisById), belongs to another database/workspace, or a malformed/truncated UUID string that never matches any row.","commonSituations":"Stale UI after the redis database was removed from another tab/session, bookmarked or cached URL with an old redisId, copy/paste typo in an API script, or a deleted row while a deployment is still in flight.","solutions":["Verify the redisId exists: list redis databases for the project and confirm the ID matches","If the record was deleted, re-create the redis database and use the new redisId","Check for stray whitespace/quotes around the ID string when copied from logs or URLs"],"exampleFix":"// before\nconst r = await findRedisById(redisId);\n\n// after\nconst r = await findRedisById(redisId).catch((e) => {\n  if (e instanceof TRPCError && e.code === \"NOT_FOUND\") {\n    throw new Error(`Redis ${redisId} no longer exists; refresh the list`);\n  }\n  throw e;\n});","handlingStrategy":"try-catch","validationCode":"const exists = await db.select().from(redis).where(eq(redis.redisId, redisId)).limit(1);\nif (exists.length === 0) throw new Error(`Redis ${redisId} does not exist`);","typeGuard":"const isTRPCNotFound = (e: unknown): e is TRPCError =>\n  e instanceof TRPCError && e.code === \"NOT_FOUND\";","tryCatchPattern":"try { const r = await findRedisById(redisId); } catch (e) { if (isTRPCNotFound(e)) { /* refresh list / recreate */ } throw e; }","preventionTips":["Resolve IDs from a fresh list query instead of caching them","Treat NOT_FOUND as an expected branch in UI code (show 'deleted elsewhere' state)"],"tags":["dokploy","redis","not-found","drizzle","trpc"],"backgroundTag":"resource-not-found","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}