{"record":{"id":"2ba2933a37fb887d","repo":"apache/beam","slug":"hdfs-full-urls-should-be-bool-got-s","errorCode":null,"errorMessage":"hdfs_full_urls should be bool, got: %s","messagePattern":"hdfs_full_urls should be bool, got: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/hadoopfilesystem.py","lineNumber":140,"sourceCode":"      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/...\n        or in the form hdfs://server/path/...\n","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/hadoopfilesystem.py#L122-L158","documentation":"hdfs_full_urls controls whether paths are treated as complete WebHDFS URLs including the host. HadoopFileSystem enforces that it is a bool; any other type (string 'true', int, None from an explicit get default mismatch) triggers ValueError 'hdfs_full_urls should be bool, got: %s'.","triggerScenarios":"Passing --hdfs_full_urls as a non-boolean value (e.g. 'yes', '1' in a dict it stays a str), or a dict options entry with 'hdfs_full_urls': 'true' / 1 instead of True/False.","commonSituations":"YAML/JSON configs that supply the flag as a string; users passing 0/1; templated pipelines that interpolate the flag as text.","solutions":["Cast the value to bool before constructing: bool(my_full_urls) only if it truly represents a boolean.","Pass True or False literals, not 'true'/'false' strings.","Use the typed HadoopFileSystemOptions option so Beam parses the flag properly.","Coerce in a wrapper: opts['hdfs_full_urls'] = str(opts['hdfs_full_urls']).lower() == 'true'."],"exampleFix":"// before\noptions = {'hdfs_full_urls': 'true'}\n// after\noptions = {'hdfs_full_urls': True}","handlingStrategy":"type-guard","validationCode":"def as_bool(v):\n    if isinstance(v, bool):\n        return v\n    if isinstance(v, str):\n        return v.lower() == 'true'\n    raise ValueError('hdfs_full_urls must be bool')\nopts['hdfs_full_urls'] = as_bool(opts.get('hdfs_full_urls', False))","typeGuard":"def is_real_bool(x: object) -> bool:\n    return isinstance(x, bool)","tryCatchPattern":"try:\n    fs = HadoopFileSystem(pipeline_options=opts)\nexcept ValueError as e:\n    if 'hdfs_full_urls should be bool' in str(e):\n        opts['hdfs_full_urls'] = str(opts['hdfs_full_urls']).lower() == 'true'\n        fs = HadoopFileSystem(pipeline_options=opts)\n    else:\n        raise","preventionTips":["Pass true booleans, not 'true'/'false' strings or 0/1","Coerce string config values from YAML/JSON before constructing options","Use the typed HadoopFileSystemOptions flag so parsing is handled","Add a preflight type check for boolean flags"],"tags":["hdfs","type-error","configuration","apache-beam"],"backgroundTag":"config-type-mismatch","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}