{"record":{"id":"007317ddfe725f0c","repo":"apache/hadoop","slug":"invalid-http-delete-operation-0","errorCode":null,"errorMessage":"Invalid HTTP DELETE operation [{0}]","messagePattern":"Invalid HTTP DELETE operation \\[(.+?)\\]","errorType":"exception","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":666,"sourceCode":"        AUDIT_LOG.info(\"[{}] recursive [{}]\", path, recursive);\n        FSOperations.FSDelete command =\n          new FSOperations.FSDelete(path, recursive);\n        JSONObject json = fsExecute(user, command);\n        response = Response.ok(json).type(MediaType.APPLICATION_JSON).build();\n        break;\n      }\n      case DELETESNAPSHOT: {\n        String snapshotName = params.get(SnapshotNameParam.NAME,\n            SnapshotNameParam.class);\n        FSOperations.FSDeleteSnapshot command =\n                new FSOperations.FSDeleteSnapshot(path, snapshotName);\n        fsExecute(user, command);\n        AUDIT_LOG.info(\"[{}] deleted snapshot [{}]\", path, snapshotName);\n        response = Response.ok().build();\n        break;\n      }\n      default: {\n        throw new IOException(\n          MessageFormat.format(\"Invalid HTTP DELETE operation [{0}]\",\n                               op.value()));\n      }\n    }\n    return response;\n  }\n\n  /**\n   * Special binding for '/' as it is not handled by the wildcard binding.\n   * @param is the inputstream for the request payload.\n   * @param uriInfo the of the request.\n   * @param op the HttpFS operation of the request.\n   * @param request the HttpFS request.\n   *\n   * @return the request response.\n   *\n   * @throws IOException thrown if an IO error occurred. Thrown exceptions are\n   *           handled by {@link HttpFSExceptionProvider}.","sourceCodeStart":648,"sourceCodeEnd":684,"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#L648-L684","documentation":"HttpFSServer.delete() dispatches DELETE requests over the operations registered for the DELETE verb (DELETE, DELETESNAPSHOT, ...) and throws IOException('Invalid HTTP DELETE operation [<op>]') from the default branch for any other op value. It signals that the op either belongs to a different verb or is unknown to this server.","triggerScenarios":"DELETE ?op=RMDIR (not an HttpFS op — DELETE is); DELETE ?op=RENAME (a PUT op); DELETE ?op=DELETESNAPSHOT on an older server without snapshot support; typo such as op=deletesnapshots.","commonSituations":"Scripts authored against a different Hadoop version; snapshot operations hitting a pre-snapshot HttpFS; REST clients that map every 'remove' action to HTTP DELETE with a guessed op name.","solutions":["Use op=DELETE for path removal: DELETE /webhdfs/v1/path?op=DELETE&recursive=true.","For snapshots confirm spelling op=DELETESNAPSHOT plus the snapshotname parameter, and that the server's version supports snapshots.","Match the verb to the operation per the WebHDFS spec and verify the server's Hadoop version supports the op."],"exampleFix":"# before\n$ curl -X DELETE 'http://host:14000/webhdfs/v1/tmp/old?op=RMDIR&user.name=alice'\n\n# after\n$ curl -X DELETE 'http://host:14000/webhdfs/v1/tmp/old?op=DELETE&recursive=true&user.name=alice'","handlingStrategy":"validation","validationCode":"Set<String> DELETE_OPS = Set.of(\"DELETE\", \"DELETESNAPSHOT\");\nif (!DELETE_OPS.contains(op)) {\n  throw new IllegalArgumentException(op + \" is not a DELETE operation\");\n}","typeGuard":"static boolean isValidDeleteOp(String op) {\n  return Set.of(\"DELETE\", \"DELETESNAPSHOT\").contains(op);\n}","tryCatchPattern":"try {\n  resp = http.delete(buildUrl(op));\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Invalid HTTP DELETE operation\")) {\n    throw new IllegalArgumentException(\"Wrong verb or unsupported op \" + op, e);\n  }\n  throw e;\n}","preventionTips":["Only DELETE and DELETESNAPSHOT ride the DELETE verb — encode that in client code.","Validate op names case-sensitively against the server version's spec.","Add contract tests for every delete-path call."],"tags":["httpfs","webhdfs","rest-api","http-delete","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"}