anomalyco/sst · error · Error

Unsupported memory: ${v}. The supported values for memory fo

Error message

Unsupported memory: ${v}. The supported values for memory for a ${cpu} CPU are ${Object.keys(supportedMemories[cpu]).join(", ")}

What it means

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.

Source

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

    }

    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(", ")}`,
          );
        }
        return v;
      });
    }

    function normalizeStorage() {
      return output(args.storage ?? "21 GB").apply((v) => {
        const storage = toGBs(v);
        if (storage < 21 || storage > 200)
          throw new Error(
            `Unsupported storage: ${v}. The supported value for storage is between "21 GB" and "200 GB"`,
          );
        return v;
      });

View on GitHub (pinned to a0bd20f762)

Solutions

  1. 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")
  2. Ensure the exact format "N GB" with a space
  3. Scale CPU up if you need more memory, keeping the pair within the supported map
  4. Remove `memory` to use the default "0.5 GB"

Example fix

// before
new sst.aws.Service("Api", { cpu: "0.25 vCPU", memory: "8 GB" });
// after
new sst.aws.Service("Api", { cpu: "1 vCPU", memory: "8 GB" });
Defensive patterns

Strategy: validation

Validate before calling

const supportedMemories: Record<string, string[]> = {
  "0.25 vCPU": ["0.5 GB", "1 GB", "2 GB"],
  "0.5 vCPU": ["1 GB", "2 GB", "3 GB", "4 GB"],
};
if (args.cpu && args.memory && !supportedMemories[args.cpu]?.includes(args.memory)) {
  throw new Error(`Unsupported memory ${args.memory} for ${args.cpu}`);
}

Prevention

When it happens

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

Common situations: Mismatched CPU/memory combos after scaling up CPU; copying ECS task numbers; forgetting Fargate's coupled CPU/memory constraints.

Related errors


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