{"record":{"id":"064a75c0a76d3cc3","repo":"apache/hadoop","slug":"failed-to-initialize-restcsrfpreventionfilter","errorCode":null,"errorMessage":"Failed to initialize RestCsrfPreventionFilter.","messagePattern":"Failed to initialize RestCsrfPreventionFilter\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/RestCsrfPreventionFilterHandler.java","lineNumber":178,"sourceCode":"   *\n   * @param conf configuration to read\n   * @return initialized filter, or null if CSRF protection not enabled\n   */\n  public static RestCsrfPreventionFilter initializeState(\n      Configuration conf) {\n    if (!conf.getBoolean(DFS_WEBHDFS_REST_CSRF_ENABLED_KEY,\n        DFS_WEBHDFS_REST_CSRF_ENABLED_DEFAULT)) {\n      return null;\n    }\n    String restCsrfClassName = RestCsrfPreventionFilter.class.getName();\n    Map<String, String> restCsrfParams = RestCsrfPreventionFilter\n        .getFilterParams(conf, \"dfs.webhdfs.rest-csrf.\");\n    RestCsrfPreventionFilter filter = new RestCsrfPreventionFilter();\n    try {\n      filter.init(new DatanodeHttpServer\n          .MapBasedFilterConfig(restCsrfClassName, restCsrfParams));\n    } catch (ServletException e) {\n      throw new IllegalStateException(\n          \"Failed to initialize RestCsrfPreventionFilter.\", e);\n    }\n    return(filter);\n  }\n}\n","sourceCodeStart":160,"sourceCodeEnd":184,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/RestCsrfPreventionFilterHandler.java#L160-L184","documentation":"Error \"Failed to initialize RestCsrfPreventionFilter.\" thrown in apache/hadoop.","triggerScenarios":"DataNode HTTP server startup when the RestCsrfPreventionFilter cannot be initialized from its configuration.","commonSituations":"See trigger scenarios.","solutions":["Check the RestCsrfPreventionFilter init parameters (allowed user agents, browser-useragents regex) in the DataNode web config.","Review the DataNode log for the underlying exception and correct the filter configuration."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}