anomalyco/sst · error · Error

Unsupported CPU: ${v}. The supported values for CPU are ${Ob

Error message

Unsupported CPU: ${v}. The supported values for CPU are ${Object.keys(supportedCpus).join(", ")}

What it means

`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.

Source

Thrown at platform/src/components/aws/service-v1.ts:188

    }

    function normalizeImage() {
      return all([args.image ?? {}, architecture]).apply(
        ([image, architecture]) => ({
          ...image,
          context: image.context ?? ".",
          platform:
            architecture === "arm64"
              ? Platform.Linux_arm64
              : Platform.Linux_amd64,
        }),
      );
    }

    function normalizeCpu() {
      return output(args.cpu ?? "0.25 vCPU").apply((v) => {
        if (!supportedCpus[v]) {
          throw new Error(
            `Unsupported CPU: ${v}. The supported values for CPU are ${Object.keys(
              supportedCpus,
            ).join(", ")}`,
          );
        }
        return v;
      });
    }

    function normalizeMemory() {
      return all([cpu, args.memory ?? "0.5 GB"]).apply(([cpu, v]) => {
        if (!(v in supportedMemories[cpu])) {
          throw new Error(
            `Unsupported memory: ${v}. The supported values for memory for a ${cpu} CPU are ${Object.keys(
              supportedMemories[cpu],
            ).join(", ")}`,
          );
        }

View on GitHub (pinned to a0bd20f762)

Solutions

  1. 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", ...)
  2. Match the casing/format shown in supportedCpus — include the space and "vCPU" unit
  3. Remove the `cpu` arg to use the default "0.25 vCPU"

Example fix

// before
new sst.aws.Service("Api", { cpu: "512" });
// after
new sst.aws.Service("Api", { cpu: "0.5 vCPU" });
Defensive patterns

Strategy: validation

Validate before calling

const supportedCpus = ["0.25 vCPU","0.5 vCPU","1 vCPU","2 vCPU","4 vCPU","8 vCPU","16 vCPU"];
if (args.cpu && !supportedCpus.includes(args.cpu)) {
  throw new Error(`Unsupported CPU: ${args.cpu}`);
}

Type guard

function isSupportedCpu(v: string): boolean {
  return ["0.25 vCPU","0.5 vCPU","1 vCPU","2 vCPU","4 vCPU","8 vCPU","16 vCPU"].includes(v);
}

Prevention

When it happens

Trigger: 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.

Common situations: Copying ECS task-definition numbers (256/512) instead of the "0.25 vCPU" string format; guessing formats; outdated docs.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/dfa761af4fc9b134. Report an issue: GitHub.