{"record":{"id":"1b71dbf673924ecc","repo":"anomalyco/sst","slug":"database-instance-not-found-in-cluster-cluster-i","errorCode":null,"errorMessage":"Database instance not found in cluster ${cluster.id}","messagePattern":"Database instance not found in cluster (.+?)","errorType":"exception","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/aurora.ts","lineNumber":741,"sourceCode":"      });\n\n      const instance = rds.ClusterInstance.get(\n        `${name}Instance`,\n        rds\n          .getInstancesOutput(\n            {\n              filters: [\n                {\n                  name: \"db-cluster-id\",\n                  values: [cluster.id],\n                },\n              ],\n            },\n            { parent: self },\n          )\n          .instanceIdentifiers.apply((ids) => {\n            if (!ids.length) {\n              throw new VisibleError(\n                `Database instance not found in cluster ${cluster.id}`,\n              );\n            }\n            return ids[0];\n          }),\n        undefined,\n        { parent: self },\n      );\n\n      const secretId = cluster.tagsAll\n        .apply((tags) => tags?.[\"sst:ref:password\"])\n        .apply((passwordTag) => {\n          if (!passwordTag)\n            throw new VisibleError(\n              `Failed to get password for Postgres ${name}.`,\n            );\n          return passwordTag;\n        });","sourceCodeStart":723,"sourceCodeEnd":759,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/aurora.ts#L723-L759","documentation":"When you reference an existing Aurora RDS component via `Aurora.get(...).ref` (through the `reference` helper), SST fetches the cluster's instance identifiers and picks the first one. If the cluster reports zero instances, SST cannot build a connection target and throws with the cluster's Pulumi resource ID.","triggerScenarios":"Referencing an Aurora cluster whose all instances were deleted (or the cluster is being created and instances aren't ready, or the referenced `cluster.id` points to a non-existent/empty cluster).","commonSituations":"Pointing `ref` at the wrong cluster (typo in cluster ARN/id or wrong stage), an Aurora Serverless v2 cluster whose writer instance failed to provision, or a race where the ref is evaluated before instances exist.","solutions":["Verify the referenced cluster exists and has at least one running instance: `aws rds describe-db-instances --db-cluster-identifier <cluster>`","Correct the `cluster.id`/ref in sst.config.ts to point at the intended Aurora component","Re-run `sst deploy` so the cluster finishes provisioning before referencing it (check for failed instance creation in the AWS console)"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"null","typeGuard":null,"tryCatchPattern":"try {\n  const db = sst.aws.Aurora.get(\"DbRef\", { clusterArn, databaseName, password });\n  const conn = db.ref;\n} catch (e) {\n  if (String(e).includes(\"Database instance not found\")) {\n    throw new Error(\"Referenced Aurora cluster has no instances — check cluster id and that the cluster is running: aws rds describe-db-clusters\");\n  }\n  throw e;\n}","preventionTips":["Confirm the referenced cluster has a running writer instance before adding refs (aws rds describe-db-instances)","Double-check cluster ARN/id and stage when referencing across stacks","Deploy/verify the cluster first, then deploy the referencing app to avoid race conditions"],"tags":["aurora","rds","reference","resource-not-found"],"backgroundTag":"resource-not-found","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}