{"record":{"id":"7df4995e21a25967","repo":"floci-io/floci","slug":"invalidargument","errorCode":"InvalidArgument","errorMessage":"Unknown tagging operation.","messagePattern":"Unknown tagging operation\\.","errorType":"error_code","errorClass":"AwsException","httpStatus":400,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontController.java","lineNumber":974,"sourceCode":"        } catch (AwsException e) {\n            return xmlErrorResponse(e);\n        }\n    }\n\n    @POST\n    @Path(\"/tagging\")\n    public Response tagging(@QueryParam(\"Operation\") String operation,\n                            @QueryParam(\"Resource\") String resource,\n                            String body) {\n        try {\n            if (\"Tag\".equals(operation)) {\n                Map<String, String> tags = parseTags(body);\n                service.tagResource(resource, tags);\n            } else if (\"Untag\".equals(operation)) {\n                List<String> keys = XmlParser.extractAll(body, \"Key\");\n                service.untagResource(resource, keys);\n            } else {\n                throw new AwsException(\"InvalidArgument\", \"Unknown tagging operation.\", 400);\n            }\n            return Response.noContent().build();\n        } catch (AwsException e) {\n            return xmlErrorResponse(e);\n        }\n    }\n\n    // ── Continuous Deployment Policies ───────────────────────────────────────\n\n    @POST\n    @Path(\"/continuous-deployment-policy\")\n    public Response createContinuousDeploymentPolicy(String body) {\n        try {\n            ContinuousDeploymentPolicy policy = parseContinuousDeploymentPolicy(body);\n            policy = service.createContinuousDeploymentPolicy(policy);\n            String xml = xmlContinuousDeploymentPolicyResponse(policy);\n            return Response.created(URI.create(\"/2020-05-31/continuous-deployment-policy/\" + policy.getId()))\n                    .type(XML)","sourceCodeStart":956,"sourceCodeEnd":992,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontController.java#L956-L992","documentation":"CloudFront exposes a single tagging endpoint (POST/GET ?Operation=...) that multiplexes TagResource and UntagResource based on the Operation query parameter. This controller only accepts Operation=Tag (with an XML Tags body) and Operation=Untag (with TagKeys); any other value — including a missing, misspelled, or wrong-case parameter — throws InvalidArgument 'Unknown tagging operation' (400).","triggerScenarios":"POST to /2020-05-31/tagging?Resource=<arn> without an Operation query parameter; Operation=tag (lowercase) or Operation=TagResource; a typo like Operation=UntagResource; calling with Operation=ListTags, which this endpoint does not support.","commonSituations":"SDK TagResource/UntagResource calls routed to a wrong path by a custom HTTP layer; handcrafted curl requests that forget the query param; code ported from other AWS tagging APIs that use separate endpoints per verb; case-sensitive comparisons surprising users.","solutions":["Use exactly Operation=Tag for tagging and Operation=Untag for untagging, with the Resource query parameter set to the full ARN.","Prefer the AWS SDK's tagResource/untagResource methods, which build the correct query string.","Check for typos and casing in the query string — matching is case-sensitive ('Tag', not 'tag').","Verify the request goes to POST /2020-05-31/tagging with the XML body (Tags or TagKeys) matching the operation."],"exampleFix":"# before (throws InvalidArgument: Unknown tagging operation)\ncurl -X POST \"$ENDPOINT/2020-05-31/tagging?Resource=$ARN\" \\\n  -d '<Tags><Items><Tag><Key>env</Key><Value>prod</Value></Tag></Items></Tags>'\n\n# after\ncurl -X POST \"$ENDPOINT/2020-05-31/tagging?Operation=Tag&Resource=$ARN\" \\\n  -d '<Tags><Items><Tag><Key>env</Key><Value>prod</Value></Tag></Items></Tags>'","handlingStrategy":"validation","validationCode":"java.net.URI uri = java.net.URI.create(requestUrl);\nString op = java.net.URLEncoder.encode(\"Tag\", java.nio.charset.StandardCharsets.UTF_8);\n// Assert the query string carries an accepted operation before sending\nMap<String, String> q = java.net.URI.create(requestUrl).getRawQuery() == null\n        ? Map.of() : java.util.Arrays.stream(java.net.URI.create(requestUrl).getRawQuery().split(\"&\"))\n            .map(p -> p.split(\"=\", 2)).collect(java.util.stream.Collectors.toMap(p -> p[0], p -> p[1]));\nif (!(\"Tag\".equals(q.get(\"Operation\")) || \"Untag\".equals(q.get(\"Operation\"))) || q.get(\"Resource\") == null) {\n    throw new IllegalArgumentException(\"CloudFront tagging requires ?Operation=Tag|Untag and ?Resource=<arn>\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    client.tagResource(r -> r.resource(arn).tags(t -> t.items(tagList)));\n} catch (CloudFrontException e) {\n    if (\"InvalidArgument\".equals(e.awsErrorDetails().errorCode())\n            && e.getMessage().contains(\"tagging\")) {\n        // custom HTTP layer dropped/mangled the Operation query param; rebuild request\n        throw new IllegalStateException(\"Tagging request missing Operation=Tag|Untag\", e);\n    }\n    throw e;\n}","preventionTips":["Use the SDK's tagResource/untagResource rather than hand-built URLs.","If hand-building, always include Operation=Tag or Operation=Untag (exact case) plus Resource=<arn>.","Add a unit assertion on the outgoing query string in custom HTTP clients."],"tags":["cloudfront","aws","tagging","query-parameter","invalid-argument"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}