{"record":{"id":"e602aa84536d2bd6","repo":"floci-io/floci","slug":"validationerror-e602aa","errorCode":"ValidationError","errorMessage":"StackSetName must not be empty","messagePattern":"StackSetName must not be empty","errorType":"validation","errorClass":"AwsException","httpStatus":400,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/cloudformation/StackSetService.java","lineNumber":61,"sourceCode":"    private final StorageBackend<String, StackSetOperation> operations;\n\n    @Inject\n    public StackSetService(CloudFormationService cfnService, StorageFactory storageFactory) {\n        this.cfnService = cfnService;\n        this.stackSets = storageFactory.create(\"cloudformation\", \"cloudformation-stacksets.json\",\n                new TypeReference<Map<String, StackSet>>() {});\n        this.instances = storageFactory.create(\"cloudformation\", \"cloudformation-stackset-instances.json\",\n                new TypeReference<Map<String, StackInstance>>() {});\n        this.operations = storageFactory.create(\"cloudformation\", \"cloudformation-stackset-operations.json\",\n                new TypeReference<Map<String, StackSetOperation>>() {});\n    }\n\n    // ── StackSet lifecycle ─────────────────────────────────────────────────────\n\n    public StackSet createStackSet(String name, String templateBody, Map<String, String> parameters,\n                                   List<String> capabilities, Map<String, String> tags, String description) {\n        if (name == null || name.isBlank()) {\n            throw new AwsException(\"ValidationError\", \"StackSetName must not be empty\", 400);\n        }\n        if (stackSets.get(name).isPresent()) {\n            throw new AwsException(\"NameAlreadyExistsException\",\n                    \"StackSet already exists: \" + name, 409);\n        }\n        // AWS rejects CreateStackSet with no template; the handler resolves TemplateBody/TemplateURL\n        // to null when neither is supplied. Without this guard a later CreateStackInstances would\n        // deploy empty (\"{}\") stacks into every target account.\n        if (templateBody == null || templateBody.isBlank()) {\n            throw new AwsException(\"ValidationError\",\n                    \"Either TemplateBody or TemplateURL must be specified\", 400);\n        }\n        StackSet ss = new StackSet();\n        ss.setStackSetName(name);\n        ss.setStackSetId(name + \":\" + UUID.randomUUID());\n        ss.setTemplateBody(templateBody);\n        ss.setDescription(description);\n        if (parameters != null) {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/cloudformation/StackSetService.java#L43-L79","documentation":"ValidationError from StackSetService.createStackSet when the StackSetName parameter is null or blank. Floci mirrors AWS's requirement that CreateStackSet always carries a non-empty name.","triggerScenarios":"CreateStackSet called via SDK/CLI with StackName omitted or set to an empty/whitespace string — typically a client bug where the field was never populated.","commonSituations":"Code building the request from a variable that is null (env var not set, upstream config missing), or a serialization issue that drops the StackSetName field from the Query/JSON request.","solutions":["Set an explicit, non-blank StackSetName on the CreateStackSet request before sending.","Trace where the name value originates (env var, config file) and validate it is populated at startup rather than at call time.","Note the field is StackSetName (not StackName) on CreateStackSet — using the wrong field leaves it null."],"exampleFix":"// before\ncfn.createStackSet(req -> req.stackSetName(stackName)); // stackName may be null\n\n// after\nif (stackName == null || stackName.isBlank()) throw new IllegalArgumentException(\"stackName required\");\ncfn.createStackSet(req -> req.stackSetName(stackName));","handlingStrategy":"validation","validationCode":"if (stackSetName == null || stackSetName.isBlank()) {\n    throw new IllegalArgumentException(\"StackSetName is required\");\n}\ncfn.createStackSet(req -> req.stackSetName(stackSetName)...);","typeGuard":null,"tryCatchPattern":"catch CloudFormationException code ValidationError message \"StackSetName must not be empty\" — this is always a caller bug; fix the request construction rather than retrying.","preventionTips":["Validate required request fields client-side before calling","Fail fast at startup on unset env/config that feeds StackSetName","Remember the field is StackSetName, not StackName, on stack-set APIs"],"tags":["cloudformation","stacksets","validation"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}