Skip to content

TypeError: object async_generator can't be used in 'await' expression when using -dL on Python 3.13 #48

@INTELEON404

Description

@INTELEON404

Bug Report: -dL Fails with TypeError: object async_generator can't be used in 'await' expression on Python 3.13

Summary

Using the -dL option to load domains from a file causes Subdominator to crash with a TypeError on Python 3.13.

The issue appears to be caused by awaiting an async generator instead of iterating over it with async for.


Environment

Component Version
Subdominator v3.0.1
Python 3.13.x
Operating System Kali Linux
Installation Method pipx

Command Used

subdominator -dL wildcards.txt -o subdomain.txt

Input File

wildcards.txt

example.com
test.com

Expected Behavior

Subdominator should:

  1. Read domains from the file specified with -dL
  2. Enumerate subdomains normally
  3. Save results to the output file

Actual Behavior

The application terminates immediately with the following exception:

TypeError: object async_generator can't be used in 'await' expression

Full Stack Trace

[INFO]: Loading provider configuration from /home/inteleon404/.config/Subdominator/provider-config.yaml

Traceback (most recent call last):
  File "/home/inteleon404/.local/bin/subdominator", line 6, in <module>
    sys.exit(main())
             ~~~~^^
  File "/home/inteleon404/.local/share/pipx/venvs/subdominator/lib/python3.13/site-packages/subdominator/cli/app.py", line 375, in main
    exit_code = loop.run_until_complete(run(cancel_event=cancel_event))
  File "/usr/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/home/inteleon404/.local/share/pipx/venvs/subdominator/lib/python3.13/site-packages/subdominator/cli/app.py", line 262, in run
    domains = await _load_domains(args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/inteleon404/.local/share/pipx/venvs/subdominator/lib/python3.13/site-packages/subdominator/cli/app.py", line 111, in _load_domains
    return [line.strip() for line in await FileUtils.stream(args.domain_list) if line.strip()]
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object async_generator can't be used in 'await' expression

Suspected Root Cause

The following code appears to await an async generator:

return [line.strip() for line in await FileUtils.stream(args.domain_list) if line.strip()]

If FileUtils.stream() returns an async generator, it should not be awaited directly.


Suggested Fix

Consume the async generator using async for:

domains = []

async for line in FileUtils.stream(args.domain_list):
    if line.strip():
        domains.append(line.strip())

return domains

Reproducibility

  • Reproducible every run
  • Reproducible with multiple input files
  • Reproducible on Python 3.13
  • Tested on Python 3.12
  • Tested on Python 3.11

Additional Notes

The issue only occurs when using the -dL option.

Further testing may be needed to determine whether this is:

  • A Python 3.13 compatibility issue
  • An implementation bug in the domain list loader
  • A regression introduced in v3.0.1

Thanks for maintaining the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions