OtterMind/Chat2DB · error · ConfigurationError

Cannot collect unsupported event: {event_name}

Error message

Cannot collect unsupported event: {event_name}

What it means

Thrown by notify_qq._write_prepared_message when the GitHub event_name is not in COLLECTED_EVENT_NAMES. Only three events are collected for QQ relay: issue_comment, pull_request_review, and pull_request_review_comment. Any other event (or a typo) is rejected so the relay never persists an unsupported notification.

Source

Thrown at script/github/notify_qq.py:229

def _review_action_label(action: str, state: str) -> str:
    if action == "dismissed":
        return "评审已撤销"
    if action == "edited":
        return "评审已编辑"
    if state == "approved":
        return "评审已批准"
    if state == "changes_requested":
        return "评审要求修改"
    if state == "commented":
        return "收到评审评论"
    return "已提交评审"


def _write_prepared_message(
    path: Path, event_name: str, repository: str, message: str
) -> None:
    if event_name not in COLLECTED_EVENT_NAMES:
        raise ConfigurationError(f"Cannot collect unsupported event: {event_name}")
    path.parent.mkdir(parents=True, exist_ok=True)
    path.write_text(
        json.dumps(
            {
                "version": 1,
                "event_name": event_name,
                "repository": repository,
                "message": message,
            },
            ensure_ascii=False,
        ),
        encoding="utf-8",
    )


def _read_prepared_message(path: Path, repository: str) -> tuple[str, str]:
    if not path.is_file() or path.stat().st_size > 4096:
        raise ConfigurationError("Prepared QQ notification is missing or too large")

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Only invoke the script for issue_comment, pull_request_review, or pull_request_review_comment events.
  2. In the workflow, gate the step with an if: condition on github.event_name membership.
  3. To support a new event, add it to COLLECTED_EVENT_NAMES and implement its message builder.

Example fix

# before (workflow)
on: [push, pull_request_review]
# push -> Cannot collect unsupported event: push

# after
on:
  issue_comment:
    types: [created]
  pull_request_review:
    types: [submitted]
Defensive patterns

Strategy: validation

Validate before calling

COLLECTED_EVENT_NAMES = {
    "issue_comment", "pull_request_review", "pull_request_review_comment",
}
if event_name not in COLLECTED_EVENT_NAMES:
    raise ConfigurationError(f"Skip unsupported event: {event_name}")

Type guard

def is_collected_event(event_name: str) -> bool:
    return event_name in {
        "issue_comment", "pull_request_review", "pull_request_review_comment",
    }

Prevention

When it happens

Trigger: The workflow/dispatcher calls _write_prepared_message with an event_name outside the allowed set - e.g. 'push', 'issues', 'pull_request' (the generic event, not the review), or a misspelled name.

Common situations: A GitHub Action configured to run this script on additional events (push, issues); a renamed/typo'd event; adding a new notification type without updating COLLECTED_EVENT_NAMES.

Related errors


AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14). Data as JSON: /api/errors/0b8b0a57653af567. Report an issue: GitHub.