{"record":{"id":"10151661a8f505ae","repo":"anomalyco/sst","slug":"unsupported-memory-v-the-supported-values-for-101516","errorCode":null,"errorMessage":"Unsupported memory: ${v}. The supported values for memory for a ${cpu} CPU are ${Object.keys(supportedMemories[cpu]).join(\", \")}","messagePattern":"Unsupported memory: (.+?)\\. The supported values for memory for a (.+?) CPU are (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/service-v1.ts","lineNumber":201,"sourceCode":"    }\n\n    function normalizeCpu() {\n      return output(args.cpu ?? \"0.25 vCPU\").apply((v) => {\n        if (!supportedCpus[v]) {\n          throw new Error(\n            `Unsupported CPU: ${v}. The supported values for CPU are ${Object.keys(\n              supportedCpus,\n            ).join(\", \")}`,\n          );\n        }\n        return v;\n      });\n    }\n\n    function normalizeMemory() {\n      return all([cpu, args.memory ?? \"0.5 GB\"]).apply(([cpu, v]) => {\n        if (!(v in supportedMemories[cpu])) {\n          throw new Error(\n            `Unsupported memory: ${v}. The supported values for memory for a ${cpu} CPU are ${Object.keys(\n              supportedMemories[cpu],\n            ).join(\", \")}`,\n          );\n        }\n        return v;\n      });\n    }\n\n    function normalizeStorage() {\n      return output(args.storage ?? \"21 GB\").apply((v) => {\n        const storage = toGBs(v);\n        if (storage < 21 || storage > 200)\n          throw new Error(\n            `Unsupported storage: ${v}. The supported value for storage is between \"21 GB\" and \"200 GB\"`,\n          );\n        return v;\n      });","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/service-v1.ts#L183-L219","documentation":"Memory must be one of the Fargate-valid values for the chosen CPU, checked via the `supportedMemories[cpu]` map. The validation runs with `all([cpu, memory])` so invalid memory for a valid CPU (or vice versa) throws with the allowed list for that CPU.","triggerScenarios":"Setting `memory` to a value not in `supportedMemories[cpu]`, e.g. `memory: \"8 GB\"` with `cpu: \"0.25 vCPU\"`, or wrong string format like `\"2048\"` or `\"8GB\"`.","commonSituations":"Mismatched CPU/memory combos after scaling up CPU; copying ECS task numbers; forgetting Fargate's coupled CPU/memory constraints.","solutions":["Pick a memory value from the list in the error for your chosen CPU (e.g. \"0.25 vCPU\" supports \"0.5 GB\", \"1 GB\", \"2 GB\")","Ensure the exact format \"N GB\" with a space","Scale CPU up if you need more memory, keeping the pair within the supported map","Remove `memory` to use the default \"0.5 GB\""],"exampleFix":"// before\nnew sst.aws.Service(\"Api\", { cpu: \"0.25 vCPU\", memory: \"8 GB\" });\n// after\nnew sst.aws.Service(\"Api\", { cpu: \"1 vCPU\", memory: \"8 GB\" });","handlingStrategy":"validation","validationCode":"const supportedMemories: Record<string, string[]> = {\n  \"0.25 vCPU\": [\"0.5 GB\", \"1 GB\", \"2 GB\"],\n  \"0.5 vCPU\": [\"1 GB\", \"2 GB\", \"3 GB\", \"4 GB\"],\n};\nif (args.cpu && args.memory && !supportedMemories[args.cpu]?.includes(args.memory)) {\n  throw new Error(`Unsupported memory ${args.memory} for ${args.cpu}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate CPU/memory as a pair, not independently","Use \"N GB\" format with a space","Consult Fargate's CPU/memory compatibility table when scaling"],"tags":["ecs","fargate","memory","validation"],"backgroundTag":"invalid-resource-size","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}