{"record":{"id":"39b564d826647483","repo":"anomalyco/sst","slug":"you-cannot-provide-both-vpc-containersubnets-and","errorCode":null,"errorMessage":"You cannot provide both \"vpc.containerSubnets\" and \"vpc.serviceSubnets\" in the \"${name}\" Cluster component. The \"serviceSubnets\" property has been deprecated. Use \"containerSubnets\" instead.","messagePattern":"You cannot provide both \"vpc\\.containerSubnets\" and \"vpc\\.serviceSubnets\" in the \"(.+?)\" Cluster component\\. The \"serviceSubnets\" property has been deprecated\\. Use \"containerSubnets\" instead\\.","errorType":"exception","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/cluster.ts","lineNumber":281,"sourceCode":"    }\n\n    function normalizeVpc() {\n      // \"vpc\" is a Vpc.v1 component\n      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)!,","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/cluster.ts#L263-L299","documentation":"The Cluster's vpc config originally used serviceSubnets to place ECS services; it was deprecated and renamed to containerSubnets. Providing both is ambiguous, so SST throws instead of guessing which to use.","triggerScenarios":"new sst.aws.Cluster('X', { vpc: { containerSubnets: [...], serviceSubnets: [...] } }) — both keys set on the vpc object in normalizeVpc.","commonSituations":"Merging an older config (serviceSubnets) with newer examples (containerSubnets); an editor/auto-complete adding the new key while the old key remains.","solutions":["Remove vpc.serviceSubnets and keep only vpc.containerSubnets.","If your intention was container placement, rename serviceSubnets to containerSubnets.","Re-run sst deploy after the config change."],"exampleFix":"// before\nvpc: { containerSubnets: [...], serviceSubnets: privateSubnets }\n// after\nvpc: { containerSubnets: privateSubnets }","handlingStrategy":"validation","validationCode":"function validateClusterVpc(vpc) {\n  if (vpc?.containerSubnets && vpc?.serviceSubnets)\n    throw new Error('Use only vpc.containerSubnets (serviceSubnets is deprecated)');\n}\nvalidateClusterVpc(vpcConfig);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remove serviceSubnets from all configs; it's deprecated.","Rely on editor deprecation hints for renamed properties.","Keep cluster vpc config in one shared constant to avoid divergent keys."],"tags":["aws","ecs","vpc","deprecated-property","config-validation"],"backgroundTag":"deprecated-property-conflict","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}