{"record":{"id":"eed52c7d03704387","repo":"anomalyco/sst","slug":"missing-vpc-containersubnets-for-the-name-c","errorCode":null,"errorMessage":"Missing \"vpc.containerSubnets\" for the \"${name}\" Cluster component.","messagePattern":"Missing \"vpc\\.containerSubnets\" for the \"(.+?)\" Cluster component\\.","errorType":"exception","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/cluster.ts","lineNumber":285,"sourceCode":"      if (args.vpc instanceof VpcV1) {\n        throw new VisibleError(\n          `You are using the \"Vpc.v1\" component. Please migrate to the latest \"Vpc\" component.`,\n        );\n      }\n\n      // \"vpc\" is a Vpc component\n      if (args.vpc instanceof Vpc) {\n        return args.vpc;\n      }\n\n      // \"vpc\" is object\n      return output(args.vpc).apply((vpc) => {\n        if (vpc.containerSubnets && vpc.serviceSubnets)\n          throw new VisibleError(\n            `You cannot provide both \"vpc.containerSubnets\" and \"vpc.serviceSubnets\" in the \"${name}\" Cluster component. The \"serviceSubnets\" property has been deprecated. Use \"containerSubnets\" instead.`,\n          );\n        if (!vpc.containerSubnets && !vpc.serviceSubnets)\n          throw new VisibleError(\n            `Missing \"vpc.containerSubnets\" for the \"${name}\" Cluster component.`,\n          );\n\n        if (\n          (vpc.cloudmapNamespaceId && !vpc.cloudmapNamespaceName) ||\n          (!vpc.cloudmapNamespaceId && vpc.cloudmapNamespaceName)\n        )\n          throw new VisibleError(\n            `You must provide both \"vpc.cloudmapNamespaceId\" and \"vpc.cloudmapNamespaceName\" for the \"${name}\" Cluster component.`,\n          );\n\n        return {\n          ...vpc,\n          containerSubnets: (vpc.containerSubnets ?? vpc.serviceSubnets)!,\n          serviceSubnets: undefined,\n        };\n      });\n    }","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/cluster.ts#L267-L303","documentation":"After deprecating serviceSubnets, Cluster requires subnet IDs under vpc.containerSubnets so it knows which subnets to place tasks/containers in. If neither containerSubnets nor serviceSubnets is provided, SST cannot place the cluster's services and throws.","triggerScenarios":"new sst.aws.Cluster('X', { vpc: {} }) or vpc: { cloudmapNamespaceId: ... } with no subnets — normalizeVpc's !containerSubnets && !serviceSubnets branch fires.","commonSituations":"VPC arg left as an empty object after removing deprecated fields; switching from a Vpc component instance to a raw object but forgetting subnets; partially deleted config.","solutions":["Provide vpc.containerSubnets with an array of private subnet IDs from your VPC.","Alternatively pass a sst.aws.Vpc component instance instead of a raw object.","Ensure the given subnets are routable by your tasks (typically private subnets with NAT)."],"exampleFix":"// before\nconst cluster = new sst.aws.Cluster('MyCluster', { vpc: {} });\n// after\nconst cluster = new sst.aws.Cluster('MyCluster', {\n  vpc: { containerSubnets: ['subnet-0abc', 'subnet-1def'] }\n});","handlingStrategy":"validation","validationCode":"function requireContainerSubnets(vpc) {\n  if (!vpc?.containerSubnets && !vpc?.serviceSubnets)\n    throw new Error('Cluster vpc.containerSubnets is required (array of subnet IDs)');\n}\nrequireContainerSubnets(vpcConfig);","typeGuard":"const hasContainerSubnets = (vpc) => Array.isArray(vpc?.containerSubnets) && vpc.containerSubnets.length > 0;","tryCatchPattern":null,"preventionTips":["Always wire containerSubnets from a sst.aws.Vpc instance's outputs instead of hand-writing an empty object.","Check subnet IDs exist in the target region before deploy.","Use private subnets with NAT for ECS tasks."],"tags":["aws","ecs","vpc","subnets","missing-property"],"backgroundTag":"missing-required-config-property","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}