{"record":{"id":"7ee4256c7dec0f38","repo":"floci-io/floci","slug":"invalidaction-7ee425","errorCode":"InvalidAction","errorMessage":"Could not find operation {}","messagePattern":"Could not find operation (.+?)","errorType":"exception","errorClass":"AwsException","httpStatus":400,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailJsonHandler.java","lineNumber":41,"sourceCode":"    @Inject\n    public CloudTrailJsonHandler(CloudTrailService service, ObjectMapper mapper) {\n        this.service = service;\n        this.mapper = mapper;\n    }\n\n    public Response handle(String action, JsonNode request, String region) throws Exception {\n        return switch (action) {\n            case \"CreateTrail\" -> createTrail(request, region);\n            case \"DescribeTrails\" -> describeTrails(request, region);\n            case \"DeleteTrail\" -> deleteTrail(request, region);\n            case \"UpdateTrail\" -> updateTrail(request, region);\n            case \"PutEventSelectors\" -> putEventSelectors(request, region);\n            case \"GetEventSelectors\" -> getEventSelectors(request, region);\n            case \"StartLogging\" -> startLogging(request, region);\n            case \"StopLogging\" -> stopLogging(request, region);\n            case \"GetTrailStatus\" -> getTrailStatus(request, region);\n            case \"LookupEvents\" -> lookupEvents(request, region);\n            default -> throw new AwsException(\n                    \"InvalidAction\", \"Could not find operation \" + action, 400);\n        };\n    }\n\n    private Response createTrail(JsonNode req, String region) {\n        String name = req.path(\"Name\").asText(null);\n        String s3BucketName = req.path(\"S3BucketName\").asText(null);\n        String s3KeyPrefix = req.has(\"S3KeyPrefix\") ? req.path(\"S3KeyPrefix\").asText(null) : null;\n        String snsTopicArn = req.has(\"SnsTopicARN\") ? req.path(\"SnsTopicARN\").asText(null)\n                : req.has(\"SnsTopicName\") ? req.path(\"SnsTopicName\").asText(null) : null;\n        boolean includeGlobal = req.path(\"IncludeGlobalServiceEvents\").asBoolean(true);\n        boolean isMultiRegion = req.path(\"IsMultiRegionTrail\").asBoolean(false);\n        boolean enableLogFileValidation = req.path(\"EnableLogFileValidation\").asBoolean(false);\n        boolean isOrganizationTrail = req.path(\"IsOrganizationTrail\").asBoolean(false);\n\n        Trail trail = service.createTrail(region, name, s3BucketName, s3KeyPrefix, snsTopicArn,\n                includeGlobal, isMultiRegion, enableLogFileValidation, isOrganizationTrail);\n","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailJsonHandler.java#L23-L59","documentation":"Thrown by Floci's CloudTrail JSON handler when the X-Amz-Target action is not one of the ten implemented CloudTrail operations (CreateTrail, DescribeTrails, DeleteTrail, UpdateTrail, PutEventSelectors, GetEventSelectors, StartLogging, StopLogging, GetTrailStatus, LookupEvents). The switch default raises InvalidAction with the unmatched action name, mirroring AWS's response to an unknown action.","triggerScenarios":"Calling a CloudTrail operation Floci does not implement yet (e.g. ListPublicKeys, PutInsightSelectors, RestoreEventDataStore) via SDK/CLI or raw X-Amz-Target header; a typo in a hand-crafted target header; an SDK newer than the emulator's coverage.","commonSituations":"Porting a test suite from real AWS to Floci that exercises lesser-used CloudTrail APIs; version skew between the AWS SDK in use and the emulator build; hand-rolled HTTP clients with copy-paste target strings.","solutions":["Check the supported-action list above and restrict the test/tooling to those operations against Floci.","If a raw request, verify the X-Amz-Target header format: AwsCloudTrailVersion20131101.<Action>.","For genuinely missing operations, file/track an emulator coverage request or implement the handler case locally."],"exampleFix":"// before\ncloudtrailClient.listPublicKeys(); // not implemented by emulator\n\n// after\n// use only implemented actions, e.g.\ncloudtrailClient.describeTrails();","handlingStrategy":"validation","validationCode":"Set<String> SUPPORTED = Set.of(\"CreateTrail\",\"DescribeTrails\",\"DeleteTrail\",\"UpdateTrail\",\n    \"PutEventSelectors\",\"GetEventSelectors\",\"StartLogging\",\"StopLogging\",\n    \"GetTrailStatus\",\"LookupEvents\");\nif (!SUPPORTED.contains(action)) {\n    throw new UnsupportedOperationException(\"CloudTrail action not supported by emulator: \" + action);\n}","typeGuard":null,"tryCatchPattern":"try {\n    dispatch(action, request);\n} catch (InvalidActionException e) {\n    // unsupported by emulator: skip or run only against real AWS\n}","preventionTips":["Version-gate CloudTrail features against the emulator's supported action list in test suites.","Prefer SDK clients over hand-crafted X-Amz-Target headers to avoid typos."],"tags":["aws","cloudtrail","invalid-action","unsupported-operation","emulator-limits"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}