anomalyco/sst · error

Invalidation ID not found

Error message

Invalidation ID not found

What it means

After calling CloudFront `CreateInvalidation`, the handler validates that the response contains an invalidation with a non-nil Id, which is required to wait for completion. If AWS returns a nil `Invalidation`/`Id` (unexpected response shape), this error is raised for Create/Update of the distribution-invalidation resource.

Source

Thrown at pkg/server/resource/aws-distribution-invalidation.go:96

		wildcardEnd := int(math.Min(float64((i+1)*WILDCARD_LIMIT), float64(wildcardCount)))
		stepPaths := append(pathsFile[fileStart:fileEnd], pathsWildcard[wildcardStart:wildcardEnd]...)

		result, err := client.CreateInvalidation(r.context, &cloudfront.CreateInvalidationInput{
			DistributionId: aws.String(input.DistributionId),
			InvalidationBatch: &types.InvalidationBatch{
				CallerReference: aws.String(strconv.FormatInt(time.Now().UnixNano(), 10)),
				Paths: &types.Paths{
					Quantity: aws.Int32(int32(len(stepPaths))),
					Items:    stepPaths,
				},
			},
		})
		if err != nil {
			return err
		}

		if result.Invalidation == nil || result.Invalidation.Id == nil {
			return fmt.Errorf("Invalidation ID not found")
		}

		// Have to wait for invalidation if there are multiple steps
		if input.Wait || stepsCount > 1 {
			waiter := cloudfront.NewInvalidationCompletedWaiter(client)
			err := waiter.Wait(r.context, &cloudfront.GetInvalidationInput{
				DistributionId: aws.String(input.DistributionId),
				Id:             aws.String(*result.Invalidation.Id),
			}, 10*time.Minute)
			if err != nil {
				// Suppress errors
				// log.Printf("Error waiting for invalidation: %v", err)
			}
		}
	}

	return nil
}

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Re-run the deploy — transient empty API responses usually resolve on retry
  2. Update the AWS SDK (go.mod aws-sdk-go-v2) and rebuild the CLI to match current API shapes
  3. Check AWS health/dashboard and test `aws cloudfront create-invalidation` manually to compare responses
  4. If behind a proxy/VPN, bypass it and deploy again
Defensive patterns

Strategy: retry

Try / catch

try {
  await run("sst", ["deploy"]);
} catch (e) {
  if (/Invalidation ID not found/.test(String(e))) {
    await sleep(5000);
    await run("sst", ["deploy"]); // retry; usually a transient empty AWS response
  } else throw e;
}

Prevention

When it happens

Trigger: `cloudfront.CreateInvalidation` succeeds (err == nil) but `result.Invalidation` or `result.Invalidation.Id` is nil — an unexpected/empty AWS API response, e.g. API behavior change, proxy interference, or partial response from a degraded endpoint.

Common situations: AWS API outages or regional degradation returning empty bodies; corporate proxies stripping response fields; AWS SDK version mismatches with changed response shapes; retry edge cases in the CloudFront API.

Related errors


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