apache/hadoop · error · IllegalStateException
Failed to initialize RestCsrfPreventionFilter.
Error message
Failed to initialize RestCsrfPreventionFilter.
What it means
Error "Failed to initialize RestCsrfPreventionFilter." thrown in apache/hadoop.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/RestCsrfPreventionFilterHandler.java:178
*
* @param conf configuration to read
* @return initialized filter, or null if CSRF protection not enabled
*/
public static RestCsrfPreventionFilter initializeState(
Configuration conf) {
if (!conf.getBoolean(DFS_WEBHDFS_REST_CSRF_ENABLED_KEY,
DFS_WEBHDFS_REST_CSRF_ENABLED_DEFAULT)) {
return null;
}
String restCsrfClassName = RestCsrfPreventionFilter.class.getName();
Map<String, String> restCsrfParams = RestCsrfPreventionFilter
.getFilterParams(conf, "dfs.webhdfs.rest-csrf.");
RestCsrfPreventionFilter filter = new RestCsrfPreventionFilter();
try {
filter.init(new DatanodeHttpServer
.MapBasedFilterConfig(restCsrfClassName, restCsrfParams));
} catch (ServletException e) {
throw new IllegalStateException(
"Failed to initialize RestCsrfPreventionFilter.", e);
}
return(filter);
}
}
View on GitHub (pinned to 2add963021)
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.
When it happens
Trigger: DataNode HTTP server startup when the RestCsrfPreventionFilter cannot be initialized from its configuration.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/064a75c0a76d3cc3.
Report an issue: GitHub.