apache/beam · error · ValueError
hdfs_user is not set
Error message
hdfs_user is not set
What it means
HadoopFileSystemClients.__init__ resolved no hdfs_user from the pipeline options (neither HadoopFileSystemOptions nor the options dict supplied it), and WebHDFS requests cannot be authenticated on behalf of a user without it.
Source
Thrown at sdks/python/apache_beam/io/hadoopfilesystem.py:138
raise ValueError('pipeline_options is not set')
if isinstance(pipeline_options, PipelineOptions):
hdfs_options = pipeline_options.view_as(HadoopFileSystemOptions)
hdfs_host = hdfs_options.hdfs_host
hdfs_port = hdfs_options.hdfs_port
hdfs_user = hdfs_options.hdfs_user
self._full_urls = hdfs_options.hdfs_full_urls
else:
hdfs_host = pipeline_options.get('hdfs_host')
hdfs_port = pipeline_options.get('hdfs_port')
hdfs_user = pipeline_options.get('hdfs_user')
self._full_urls = pipeline_options.get('hdfs_full_urls', False)
if hdfs_host is None:
raise ValueError('hdfs_host is not set')
if hdfs_port is None:
raise ValueError('hdfs_port is not set')
if hdfs_user is None:
raise ValueError('hdfs_user is not set')
if not isinstance(self._full_urls, bool):
raise ValueError(
'hdfs_full_urls should be bool, got: %s', self._full_urls)
self._hdfs_client = hdfs.InsecureClient(
'http://%s:%s' % (hdfs_host, str(hdfs_port)), user=hdfs_user)
@classmethod
def scheme(cls):
return 'hdfs'
def _parse_url(self, url):
"""Verifies that url begins with hdfs:// prefix, strips it and adds a
leading /.
Parsing behavior is determined by HadoopFileSystemOptions.hdfs_full_urls.
Args:
url: (str) A URL in the form hdfs://path/...View on GitHub (pinned to 12126d8942)
Solutions
- Add --hdfs_user=<username> to pipeline options (e.g. the hdfs superuser or your tenant user).
- Set 'hdfs_user': 'hduser' in the options dict.
- Confirm the user has WebHDFS permissions on the target paths to avoid later permission errors.
- Validate the trio hdfs_host/hdfs_port/hdfs_user in a preflight check.
Example fix
// before PipelineOptions(['--hdfs_host=namenode.example.com', '--hdfs_port=50070']) // after PipelineOptions(['--hdfs_host=namenode.example.com', '--hdfs_port=50070', '--hdfs_user=hduser'])
Defensive patterns
Strategy: validation
Validate before calling
def require_hdfs_user(opts):
v = (opts.get('hdfs_user') if isinstance(opts, dict)
else opts.view_as(HadoopFileSystemOptions).hdfs_user)
if not v:
raise ValueError('Set --hdfs_user before launching')
return v Type guard
None
Try / catch
try:
fs = HadoopFileSystem(pipeline_options=opts)
except ValueError as e:
if 'hdfs_user is not set' in str(e):
raise SystemExit('Add --hdfs_user=<user> to pipeline options')
raise Prevention
- Always specify an explicit WebHDFS user; don't rely on OS defaults
- Verify the user has permissions on target HDFS paths
- Set hdfs_user once in a shared options helper
- Check key spelling in dict-based options
When it happens
Trigger: Initializing HadoopFileSystem with hdfs_host and hdfs_port configured but no 'hdfs_user' / --hdfs_user flag.
Common situations: Cluster configs where a default OS user is assumed but WebHDFS requires an explicit user; multi-tenant setups where the worker runs as a service account; options dict missing the key.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- pipeline_options is not set
- hdfs_host is not set
- hdfs_port is not set
- Cannot create a temporary directory for root path prefix %s.
- MatchContinuously(timestamp_cursor=True) deduplicates, so it
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/ab3f77bd8eeffb72.
Report an issue: GitHub.