{"record":{"id":"481dcb59a9468f30","repo":"floci-io/floci","slug":"invalidstructureexception","errorCode":"InvalidStructureException","errorMessage":"A pipeline must contain at least two stages","messagePattern":"A pipeline must contain at least two stages","errorType":"exception","errorClass":"AwsException","httpStatus":400,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/codepipeline/CodePipelineService.java","lineNumber":1086,"sourceCode":"\n    private List<CodePipelineStoredItem> items(String account, String region, String type) {\n        return itemStore.scanForAccount(account, key -> key.startsWith(region + \":\" + type + \":\")).stream()\n                .sorted(Comparator.comparing(CodePipelineStoredItem::getCreated,\n                        Comparator.nullsLast(Comparator.reverseOrder())))\n                .toList();\n    }\n\n    private String validatePipelineDeclaration(JsonNode declaration) {\n        if (declaration == null || !declaration.isObject()) {\n            throw new AwsException(\"ValidationException\", \"pipeline must be an object\", 400);\n        }\n        String name = declaration.path(\"name\").asText(null);\n        validatePipelineName(name);\n        if (!declaration.hasNonNull(\"roleArn\")) {\n            throw new AwsException(\"ValidationException\", \"pipeline.roleArn is required\", 400);\n        }\n        if (!declaration.path(\"stages\").isArray() || declaration.path(\"stages\").size() < 2) {\n            throw new AwsException(\"InvalidStructureException\", \"A pipeline must contain at least two stages\", 400);\n        }\n        boolean hasArtifactStore = declaration.hasNonNull(\"artifactStore\");\n        boolean hasArtifactStores = declaration.hasNonNull(\"artifactStores\");\n        if (hasArtifactStore == hasArtifactStores) {\n            throw new AwsException(\"ValidationException\",\n                    \"pipeline must include exactly one of artifactStore or artifactStores\", 400);\n        }\n        for (JsonNode stage : declaration.path(\"stages\")) {\n            if (!stage.hasNonNull(\"name\") || !stage.path(\"actions\").isArray()\n                    || stage.path(\"actions\").isEmpty()) {\n                throw new AwsException(\"InvalidStageDeclarationException\",\n                        \"Each stage must have a name and at least one action\", 400);\n            }\n        }\n        String mode = declaration.path(\"executionMode\").asText(DEFAULT_EXECUTION_MODE);\n        String type = declaration.path(\"pipelineType\").asText(DEFAULT_PIPELINE_TYPE);\n        if (!List.of(\"SUPERSEDED\", \"QUEUED\", \"PARALLEL\").contains(mode)) {\n            throw new AwsException(\"ValidationException\", \"Invalid executionMode: \" + mode, 400);","sourceCodeStart":1068,"sourceCodeEnd":1104,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/codepipeline/CodePipelineService.java#L1068-L1104","documentation":"Error \"A pipeline must contain at least two stages\" thrown in floci-io/floci.","triggerScenarios":"Thrown at src/main/java/io/github/hectorvent/floci/services/codepipeline/CodePipelineService.java:1086 when the library encounters an invalid state.","commonSituations":"Occurs when creating or updating a pipeline with fewer than two stages. Define at least a source stage and one additional stage.","solutions":["Add at least two stages to the pipeline definition."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}