{"record":{"id":"b805492c45f5d96e","repo":"anomalyco/sst","slug":"failed-to-lookup-secret-for-redis-cluster-name","errorCode":null,"errorMessage":"Failed to lookup secret for Redis cluster \"${name}\".","messagePattern":"Failed to lookup secret for Redis cluster \"(.+?)\"\\.","errorType":"exception","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/redis.ts","lineNumber":386,"sourceCode":"\n    function reference() {\n      const ref = args as unknown as RedisRef;\n      const cluster = elasticache.ReplicationGroup.get(\n        `${name}Cluster`,\n        ref.clusterId,\n        undefined,\n        { parent: self },\n      );\n\n      const input = cluster.tagsAll.apply((tags) => {\n        registerVersion(\n          tags?.[\"sst:component-version\"]\n            ? parseInt(tags[\"sst:component-version\"])\n            : undefined,\n        );\n\n        if (!tags?.[\"sst:ref:secret\"])\n          throw new VisibleError(\n            `Failed to lookup secret for Redis cluster \"${name}\".`,\n          );\n\n        return {\n          secretRef: tags?.[\"sst:ref:secret\"],\n        };\n      });\n\n      const secret = secretsmanager.getSecretVersionOutput(\n        { secretId: input.secretRef },\n        { parent: self },\n      );\n      const authToken = secret.secretString.apply((v) => {\n        return JSON.parse(v).authToken as string;\n      });\n\n      return { cluster, authToken };\n    }","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/redis.ts#L368-L404","documentation":"On ref lookups, the Redis (v2) component reads the cluster's CloudFormation tags to find the sst:ref:secret tag pointing at its auth-token secret. If that tag is absent, the reference() call throws this VisibleError because the secret reference cannot be reconstructed.","triggerScenarios":"Calling sst.aws.Redis.get()/reference() for a cluster whose stack tags lack \"sst:ref:secret\" — e.g., clusters created before that tag was introduced, modified manually, or deployed with an older SST version.","commonSituations":"Version migration (older clusters without ref tags); manual tag edits in AWS console; cross-app references to clusters not created with tagging enabled.","solutions":["Redeploy the Redis component with the current SST version so the sst:ref:secret tag is written","Manually add the sst:ref:secret tag (pointing to the auth token secret ARN) to the cluster via CloudFormation/AWS console, then retry","If the cluster predates tagging support, recreate it under the new version and reference the new cluster"],"exampleFix":"// before\nconst redis = sst.aws.Redis.get(\"Redis\", \"old-cluster\"); // throws: no sst:ref:secret tag\n// after: upgrade & redeploy the stack owning the cluster so ref tags exist\n// sst deploy (with current sst) in the source app, then:\nconst redis = sst.aws.Redis.get(\"Redis\", \"old-cluster\");","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const redis = sst.aws.Redis.get(\"Redis\", \"my-cluster\");\n} catch (e) {\n  if (String(e).includes(\"Failed to lookup secret\")) {\n    console.error(\"Cluster lacks sst:ref:secret tag; redeploy with current SST or add the tag\");\n  }\n  throw e;\n}","preventionTips":["Keep SST up to date so clusters carry the sst:ref:secret tag","Avoid manual tag edits on Redis clusters in AWS console","Redeploy legacy clusters before referencing them via Redis.get"],"tags":["redis","elasticache","secret","tags","version-migration"],"backgroundTag":"missing-secret","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}