{"record":{"id":"1a6724a29af9bceb","repo":"apache/hadoop","slug":"invalid-http-put-operation-0","errorCode":null,"errorMessage":"Invalid HTTP PUT operation [{0}]","messagePattern":"Invalid HTTP PUT operation \\[(.+?)\\]","errorType":"http","errorClass":"IOException","httpStatus":500,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSServer.java","lineNumber":1117,"sourceCode":"      case SETECPOLICY: {\n        String policyName = params.get(ECPolicyParam.NAME, ECPolicyParam.class);\n        FSOperations.FSSetErasureCodingPolicy command =\n            new FSOperations.FSSetErasureCodingPolicy(path, policyName);\n        fsExecute(user, command);\n        AUDIT_LOG.info(\"[{}] to policy [{}]\", path, policyName);\n        response = Response.ok().build();\n        break;\n    }\n    case SATISFYSTORAGEPOLICY: {\n      FSOperations.FSSatisyStoragePolicy command =\n          new FSOperations.FSSatisyStoragePolicy(path);\n      fsExecute(user, command);\n      AUDIT_LOG.info(\"satisfy storage policy for [{}]\", path);\n      response = Response.ok().build();\n      break;\n    }\n      default: {\n        throw new IOException(\n          MessageFormat.format(\"Invalid HTTP PUT operation [{0}]\",\n                               op.value()));\n      }\n    }\n    return response;\n  }\n\n}\n","sourceCodeStart":1099,"sourceCodeEnd":1126,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/HttpFSServer.java#L1099-L1126","documentation":"HttpFSServer.put() switches over the PUT-verb operations (CREATE, MKDIRS, RENAME, SETPERMISSION, SETOWNER, SETREPLICATION, SETTIMES, CREATESNAPSHOT, RENAMEWATCHSNAPSHOT?, SATISFYSTORAGEPOLICY, ...) and throws IOException('Invalid HTTP PUT operation [<op>]') from the default branch otherwise.","triggerScenarios":"PUT ?op=DELETE (a DELETE op); PUT ?op=SATISFYSTORAGEPOLICY on a server older than the storage-policy-satisfy feature; PUT ?op=SETPOLICY (typo for SETSTORAGEPOLICY); PUT ?op=APPEND (a POST op).","commonSituations":"Feature-gated ops (satisfyStoragePolicy, EC policies) sent to older HttpFS during mixed-version clusters; scripts ported between Hadoop versions; monospelled op parameters; REST frameworks that force PUT for all mutations.","solutions":["Check the op against the PUT set in the WebHDFS/HttpFS REST docs and correct verb or spelling.","If the message names a genuinely new op, upgrade the HttpFS server to a Hadoop version that implements it.","Test with curl -X PUT '<url>&op=<OP>' first to isolate client-library behavior."],"exampleFix":"# before\n$ curl -X PUT 'http://host:14000/webhdfs/v1/tmp/f?op=APPEND&user.name=alice'\n\n# after\n$ curl -X POST 'http://host:14000/webhdfs/v1/tmp/f?op=APPEND&user.name=alice' --data-binary @localfile","handlingStrategy":"validation","validationCode":"Set<String> PUT_OPS = Set.of(\"CREATE\",\"MKDIRS\",\"RENAME\",\"SETPERMISSION\",\"SETOWNER\",\n    \"SETREPLICATION\",\"SETTIMES\",\"CREATESNAPSHOT\",\"RENAME_SNAPSHOT\".replace('_',''),\n    \"SETREPLICATION\",\"SETSTORAGEPOLICY\",\"SATISFYSTORAGEPOLICY\",\"SETECPOLICY\");\nif (!PUT_OPS.contains(op)) {\n  throw new IllegalArgumentException(op + \" is not a PUT operation on this server\");\n}","typeGuard":"static boolean isValidPutOp(String op) {\n  return Set.of(\"CREATE\",\"MKDIRS\",\"RENAME\",\"SETPERMISSION\",\"SETOWNER\",\n    \"SETREPLICATION\",\"SETTIMES\",\"CREATESNAPSHOT\",\"RENAMESNAPSHOT\",\n    \"SETSTORAGEPOLICY\",\"SATISFYSTORAGEPOLICY\",\"SETECPOLICY\").contains(op);\n}","tryCatchPattern":"try {\n  resp = http.put(buildUrl(op));\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Invalid HTTP PUT operation\")) {\n    throw new IllegalArgumentException(\"Wrong verb or unsupported op \" + op, e);\n  }\n  throw e;\n}","preventionTips":["Never force all mutations through PUT; honor the per-op verb table.","After upgrading HttpFS, re-run the op contract test suite.","Beware feature-gated ops (SETECPOLICY, SATISFYSTORAGEPOLICY) on older servers."],"tags":["httpfs","webhdfs","rest-api","http-put","operation-dispatch","bad-request"],"backgroundTag":"invalid-operation-param","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}