{"record":{"id":"ab3f77bd8eeffb72","repo":"apache/beam","slug":"hdfs-user-is-not-set","errorCode":null,"errorMessage":"hdfs_user is not set","messagePattern":"hdfs_user is not set","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/hadoopfilesystem.py","lineNumber":138,"sourceCode":"      raise ValueError('pipeline_options is not set')\n    if isinstance(pipeline_options, PipelineOptions):\n      hdfs_options = pipeline_options.view_as(HadoopFileSystemOptions)\n      hdfs_host = hdfs_options.hdfs_host\n      hdfs_port = hdfs_options.hdfs_port\n      hdfs_user = hdfs_options.hdfs_user\n      self._full_urls = hdfs_options.hdfs_full_urls\n    else:\n      hdfs_host = pipeline_options.get('hdfs_host')\n      hdfs_port = pipeline_options.get('hdfs_port')\n      hdfs_user = pipeline_options.get('hdfs_user')\n      self._full_urls = pipeline_options.get('hdfs_full_urls', False)\n\n    if hdfs_host is None:\n      raise ValueError('hdfs_host is not set')\n    if hdfs_port is None:\n      raise ValueError('hdfs_port is not set')\n    if hdfs_user is None:\n      raise ValueError('hdfs_user is not set')\n    if not isinstance(self._full_urls, bool):\n      raise ValueError(\n          'hdfs_full_urls should be bool, got: %s', self._full_urls)\n    self._hdfs_client = hdfs.InsecureClient(\n        'http://%s:%s' % (hdfs_host, str(hdfs_port)), user=hdfs_user)\n\n  @classmethod\n  def scheme(cls):\n    return 'hdfs'\n\n  def _parse_url(self, url):\n    \"\"\"Verifies that url begins with hdfs:// prefix, strips it and adds a\n    leading /.\n\n    Parsing behavior is determined by HadoopFileSystemOptions.hdfs_full_urls.\n\n    Args:\n      url: (str) A URL in the form hdfs://path/...","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/hadoopfilesystem.py#L120-L156","documentation":"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.","triggerScenarios":"Initializing HadoopFileSystem with hdfs_host and hdfs_port configured but no 'hdfs_user' / --hdfs_user flag.","commonSituations":"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.","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."],"exampleFix":"// before\nPipelineOptions(['--hdfs_host=namenode.example.com', '--hdfs_port=50070'])\n// after\nPipelineOptions(['--hdfs_host=namenode.example.com', '--hdfs_port=50070', '--hdfs_user=hduser'])","handlingStrategy":"validation","validationCode":"def require_hdfs_user(opts):\n    v = (opts.get('hdfs_user') if isinstance(opts, dict)\n         else opts.view_as(HadoopFileSystemOptions).hdfs_user)\n    if not v:\n        raise ValueError('Set --hdfs_user before launching')\n    return v","typeGuard":"None","tryCatchPattern":"try:\n    fs = HadoopFileSystem(pipeline_options=opts)\nexcept ValueError as e:\n    if 'hdfs_user is not set' in str(e):\n        raise SystemExit('Add --hdfs_user=<user> to pipeline options')\n    raise","preventionTips":["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"],"tags":["hdfs","configuration","python","apache-beam"],"backgroundTag":"missing-required-config-field","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}