{"record":{"id":"dfa761af4fc9b134","repo":"anomalyco/sst","slug":"unsupported-cpu-v-the-supported-values-for-cp-dfa761","errorCode":null,"errorMessage":"Unsupported CPU: ${v}. The supported values for CPU are ${Object.keys(supportedCpus).join(\", \")}","messagePattern":"Unsupported CPU: (.+?)\\. The supported values for CPU are (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/service-v1.ts","lineNumber":188,"sourceCode":"    }\n\n    function normalizeImage() {\n      return all([args.image ?? {}, architecture]).apply(\n        ([image, architecture]) => ({\n          ...image,\n          context: image.context ?? \".\",\n          platform:\n            architecture === \"arm64\"\n              ? Platform.Linux_arm64\n              : Platform.Linux_amd64,\n        }),\n      );\n    }\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        }","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/service-v1.ts#L170-L206","documentation":"`Service`'s `cpu` arg is validated against the `supportedCpus` map (Fargate-valid CPU sizes shared with cluster-v1). If the provided string isn't a key of that map, normalizeCpu throws. The message lists every accepted value.","triggerScenarios":"Setting `cpu` to a string not exactly matching a supported value, e.g. `\"1 vCPU\"` vs `\"0.5 vCPU\"`, `\"512\"`, typo like `\"0.25 vcpu\"`, or an ECS-valid but Fargate-invalid combo.","commonSituations":"Copying ECS task-definition numbers (256/512) instead of the \"0.25 vCPU\" string format; guessing formats; outdated docs.","solutions":["Change `cpu` to one of the exact strings listed in the error (e.g. \"0.25 vCPU\", \"0.5 vCPU\", \"1 vCPU\", \"2 vCPU\", \"4 vCPU\", ...)","Match the casing/format shown in supportedCpus — include the space and \"vCPU\" unit","Remove the `cpu` arg to use the default \"0.25 vCPU\""],"exampleFix":"// before\nnew sst.aws.Service(\"Api\", { cpu: \"512\" });\n// after\nnew sst.aws.Service(\"Api\", { cpu: \"0.5 vCPU\" });","handlingStrategy":"validation","validationCode":"const supportedCpus = [\"0.25 vCPU\",\"0.5 vCPU\",\"1 vCPU\",\"2 vCPU\",\"4 vCPU\",\"8 vCPU\",\"16 vCPU\"];\nif (args.cpu && !supportedCpus.includes(args.cpu)) {\n  throw new Error(`Unsupported CPU: ${args.cpu}`);\n}","typeGuard":"function isSupportedCpu(v: string): boolean {\n  return [\"0.25 vCPU\",\"0.5 vCPU\",\"1 vCPU\",\"2 vCPU\",\"4 vCPU\",\"8 vCPU\",\"16 vCPU\"].includes(v);\n}","tryCatchPattern":null,"preventionTips":["Use the exact \"N vCPU\" string format from the error message","Centralize Fargate size constants in a shared module","Avoid copying numeric ECS task-definition CPU units"],"tags":["ecs","fargate","cpu","validation"],"backgroundTag":"invalid-resource-size","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}