floci-io/floci · error · AwsException
ValidationError
ValidationError
Error message
Stack with id {} does not exist What it means
DescribeStacks was called with a non-blank StackName (or stack id) that resolves to no stack in this region — resolveStackForDescribe returned null. Real AWS also answers ValidationError ('Stack with id ... does not exist') here, so Floci mirrors it. A blank StackName does not throw; it lists all stacks.
Source
Thrown at src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationService.java:129
/**
* Sets a stack's termination protection (CloudFormation {@code UpdateTerminationProtection}).
* Returns the stack so the caller can echo its {@code StackId}.
*/
public Stack updateTerminationProtection(String stackName, boolean enabled, String region) {
Stack stack = getStackOrThrow(stackName, region);
stack.setEnableTerminationProtection(enabled);
persistStack(stack);
return stack;
}
// ── DescribeStacks ────────────────────────────────────────────────────────
public List<Stack> describeStacks(String stackName, String region) {
if (stackName != null && !stackName.isBlank()) {
Stack stack = resolveStackForDescribe(stackName, region);
if (stack == null) {
throw new AwsException("ValidationError",
"Stack with id " + stackName + " does not exist", 400);
}
return List.of(stack);
}
return stacks.values().stream()
.filter(s -> region.equals(s.getRegion()))
.sorted(Comparator.comparing(Stack::getCreationTime))
.toList();
}
// ── CreateChangeSet ───────────────────────────────────────────────────────
public ChangeSet createChangeSet(String stackName, String changeSetName, String changeSetType,
String templateBody, String templateUrl,
Map<String, String> parameters, List<String> capabilities,
Map<String, String> tags, String region) {
String resolvedTemplate = resolveTemplate(templateBody, templateUrl);
View on GitHub (pinned to 62ff490619)
Solutions
- List what actually exists: aws cloudformation describe-stacks (no name) or list-stacks, and compare names.
- Check the region matches where the stack was created (the emulator keys stacks per region).
- If the stack was recently deleted, it is gone immediately in Floci (expired stacks are purged) — recreate it.
- For scripts, first call list-stacks and branch on presence instead of assuming.
Example fix
# before aws cloudformation describe-stacks --stack-name my-stak # typo # after aws cloudformation list-stacks --query 'StackSummaries[].StackName' aws cloudformation describe-stacks --stack-name my-stack
Defensive patterns
Strategy: try-catch
Validate before calling
const exists = await cfn.listStacks({StackStatusFilter: ['CREATE_COMPLETE','UPDATE_COMPLETE','UPDATE_ROLLBACK_COMPLETE']})
.StackSummaries.some(s => s.StackName === name);
if (!exists) return; // nothing to describe Type guard
const stackExists = (summaries, name) => summaries.some(s => s.StackName === name);
Try / catch
try {
const d = await cfn.describeStacks({StackName: name}).promise();
} catch (e) {
if (e.code === 'ValidationError' && /does not exist/.test(e.message)) return null;
throw e;
} Prevention
- Always gate describe/delete flows on list-stacks output.
- Pin the emulator region explicitly (AWS_DEFAULT_REGION) so lookups match creation region.
When it happens
Trigger: aws cloudformation describe-stacks --stack-name my-stack where my-stack was never created, was deleted (and purged), or exists in a different region; passing a stack id after the emulator's storage was reset.
Common situations: Scripts assuming a stack exists after a failed create; wrong AWS_DEFAULT_REGION / endpoint region against the emulator; persistence wiped (memory storage mode restart); typo in the stack name.
Understand the failure class
Background: ValidationError explained: why open-source libraries reject your input — file uploads, YAML manifests, unique fields, and query permissions — this error's family across 13 libraries.
Related errors
- ChangeSetNotFoundException
- ResourceNotFoundException
- ObjectNotFoundException
- ResourceNotFoundException
- InternalFailure
AI-assisted analysis of floci-io/floci@62ff490619 (2026-08-14).
Data as JSON: /api/errors/58c889785dcca8a4.
Report an issue: GitHub.