Skip to content

[Dev][Archery] crossbow notify-token-expiration fails with TypeError and drops its sender/recipient options #55269

Open

Description

@Nishuuzz

Describe the bug, including details regarding any error messages, version, and platform.

archery crossbow notify-token-expiration raises a TypeError before it builds a message, so the command cannot run at all, and its --sender-name, --sender-email and --recipient-email options are never passed on.

dev/archery/archery/crossbow/cli.py:

    report = TokenExpirationReport(token_expiration_date, days_left)
    email_report = TokenExpirationEmailReport(report)

TokenExpirationEmailReport.__init__ is def __init__(self, **kwargs), so the positional argument is rejected:

TypeError: TokenExpirationEmailReport.__init__() takes 1 positional argument but 2 were given

This happens before the if send: branch, so the dry-run path fails the same way:

$ archery crossbow notify-token-expiration \
    --sender-name 'Crossbow Reporter' \
    --sender-email sender@arrow.apache.org \
    --recipient-email recipient@arrow.apache.org
TypeError: TokenExpirationEmailReport.__init__() takes 1 positional argument but 2 were given

There is a second problem behind it. EmailReport.fields is

    fields = [
        'report',
        'sender_name',
        'sender_email',
        'recipient_email',
    ]

and Report.__init__ raises ValueError(f'Missing keyword argument {field}') for anything missing, so even written as TokenExpirationEmailReport(report=report) it fails with ValueError: Missing keyword argument sender_name. EmailReport.render() needs those three to set the From and To headers, and ReportUtils.send_email() takes no addresses of its own — it just hands the rendered message to smtplib.

Where it came from

288cd43bdc (GH-48623, #48624, first released in 24.0.0) replaced

    email_report = EmailReport(
        report=TokenExpirationReport(
            token_expiration_date or "ALREADY_EXPIRED", days_left),
        sender_name=sender_name,
        sender_email=sender_email,
        recipient_email=recipient_email
    )

with the positional call above when it introduced the TokenExpirationEmailReport subclass. The sibling nightly-report command was converted in the same commit and still passes all four keyword arguments, so only this command is affected.

Nothing in the repository invokes notify-token-expiration, which is presumably why this has gone unnoticed.

Component(s)

Developer Tools

Activity

  1. changed the title [-][Archery] crossbow notify-token-expiration fails with TypeError and drops its sender/recipient options[/-] [+][Dev][Archery] crossbow notify-token-expiration fails with TypeError and drops its sender/recipient options[/+] on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions