Skip to content

Help people get the list import format type correct #70

@jpwarren

Description

@jpwarren

Is your feature request related to a problem? Please describe.

If you incorrectly set a URL import list format to csv instead of mastodon_csv the import will fail but the error message is a bit weird.

e.g.:

2025-11-06 09:13:51,211 INFO Fetching domain blocks from URLs...
Traceback (most recent call last):
  File "/home/daedalus/src/fediblockhole/.venv/bin/fediblock-sync", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/daedalus/src/fediblockhole/src/fediblockhole/__init__.py", line 1082, in main
    sync_blocklists(args)
  File "/home/daedalus/src/fediblockhole/src/fediblockhole/__init__.py", line 78, in sync_blocklists
    fetch_from_urls(
  File "/home/daedalus/src/fediblockhole/src/fediblockhole/__init__.py", line 199, in fetch_from_urls
    bl = parse_blocklist(rawdata, url, listformat, import_fields, max_severity)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/daedalus/src/fediblockhole/src/fediblockhole/blocklists.py", line 309, in parse_blocklist
    return parser.parse_blocklist(blockdata, origin)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/daedalus/src/fediblockhole/src/fediblockhole/blocklists.py", line 109, in parse_blocklist
    block = self.parse_item(blockitem)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/daedalus/src/fediblockhole/src/fediblockhole/blocklists.py", line 200, in parse_item
    block = DomainBlock(**blockitem)
            ^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DomainBlock.__init__() missing 1 required positional argument: 'domain'

You have to turn on --loglevel debug to get a better idea of what the problem is, and which specific URL config line is causing the error.

Describe the solution you'd like

We should be able to provide an error message that helps people pinpoint which config line caused the error, and guidance on how to fix it.

Describe alternatives you've considered

We could auto-detect formats, but that can lead to opaque failures that are hard to troubleshoot. Worth considering, but a hard, obvious failure is easier to troubleshoot and know you've fixed it correctly. Too much magic makes computers harder to reason about.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions