OtterMind/Chat2DB · error · ValueError

Unsupported GitHub event: {event_name}

Error message

Unsupported GitHub event: {event_name}

What it means

Raised by build_notification (notify_qq.py:479) as a ValueError when event_name matches none of the handled events (workflow_dispatch, issue_comment, pull_request_review, pull_request_review_comment, release, deployment/deployment_status, discussion, issues, pull_request_target). It is the fall-through guard at the end of the event dispatch chain.

Source

Thrown at script/github/notify_qq.py:479

        html_url = _clean_text(discussion.get("html_url"), 500)
        if include_url and html_url:
            lines.append(f"链接:{html_url}")
        message = _join_message_lines(lines)
        return message if include_url else _remove_urls(message)

    if event_name == "issues":
        item = payload.get("issue") or {}
        item_name = "Issue"
        action_label = ISSUE_ACTIONS.get(action, f"状态已变更({action})")
    elif event_name == "pull_request_target":
        item = payload.get("pull_request") or {}
        item_name = "PR"
        if action == "closed" and item.get("merged"):
            action_label = "已合并"
        else:
            action_label = PULL_REQUEST_ACTIONS.get(action, f"状态已变更({action})")
    else:
        raise ValueError(f"Unsupported GitHub event: {event_name}")

    number = item.get("number") or payload.get("number") or "?"
    title = _clean_text(item.get("title"), 220)
    detail = _event_detail(event_name, action, payload)
    html_url = _clean_text(item.get("html_url"), 500)

    lines = [
        f"{prefix} {item_name} #{number} {action_label}",
        f"标题:{title}",
        f"操作者:{sender}",
    ]
    if detail and not detail.endswith(":"):
        lines.append(detail)
    if include_url and html_url:
        lines.append(f"链接:{html_url}")

    message = _join_message_lines(lines)
    return message if include_url else _remove_urls(message)

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Restrict the workflow's 'on:' triggers to the events build_notification handles.
  2. If a new event is needed, add a branch to build_notification and the appropriate action-label map.
  3. For test dispatches, use workflow_dispatch (which is handled).

Example fix

# before: on: [push, issues, pull_request_target]
# after: on: [issues, pull_request_target, issue_comment, release]
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {
    "workflow_dispatch", "issue_comment", "pull_request_review",
    "pull_request_review_comment", "release", "deployment",
    "deployment_status", "discussion", "issues", "pull_request_target",
}
if event_name not in SUPPORTED:
    raise SystemExit(f"event {event_name!r} not supported; restrict workflow triggers")

Type guard

def is_supported_event(event_name: str) -> bool:
    return event_name in {
        "workflow_dispatch", "issue_comment", "pull_request_review",
        "pull_request_review_comment", "release", "deployment",
        "deployment_status", "discussion", "issues", "pull_request_target",
    }

Try / catch

try:
    message = build_notification(event_name, payload, repository, actor, run_url, include_url=include_url)
except ValueError as error:
    print(f"skipping unsupported event: {error}", file=sys.stderr)
    sys.exit(0)  # or a non-fatal return

Prevention

When it happens

Trigger: The GitHub Actions workflow triggers the notifier on an event type the script does not support, e.g. push, schedule, check_run, create, fork, or a misspelled/custom event. GITHUB_EVENT_NAME carries that value into build_notification.

Common situations: Adding the workflow to a new event trigger (on: push:) without extending build_notification; a reusable workflow triggered with an unexpected event; GITHUB_EVENT_NAME set manually to an unsupported value during testing.

Related errors


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