{"record":{"id":"ee64cf10dc0bde21","repo":"OtterMind/Chat2DB","slug":"prepared-qq-notification-event-is-not-allowed","errorCode":null,"errorMessage":"Prepared QQ notification event is not allowed","messagePattern":"Prepared QQ notification event is not allowed","errorType":"validation","errorClass":"ConfigurationError","httpStatus":null,"severity":"error","filePath":"script/github/notify_qq.py","lineNumber":258,"sourceCode":"        ),\n        encoding=\"utf-8\",\n    )\n\n\ndef _read_prepared_message(path: Path, repository: str) -> tuple[str, str]:\n    if not path.is_file() or path.stat().st_size > 4096:\n        raise ConfigurationError(\"Prepared QQ notification is missing or too large\")\n    try:\n        envelope = json.loads(path.read_text(encoding=\"utf-8\"))\n    except (OSError, UnicodeError, json.JSONDecodeError) as error:\n        raise ConfigurationError(\"Prepared QQ notification is not valid JSON\") from error\n    if not isinstance(envelope, Mapping) or envelope.get(\"version\") != 1:\n        raise ConfigurationError(\"Prepared QQ notification has an invalid format\")\n    if envelope.get(\"repository\") != repository:\n        raise ConfigurationError(\"Prepared QQ notification repository does not match\")\n    event_name = str(envelope.get(\"event_name\") or \"\")\n    if event_name not in COLLECTED_EVENT_NAMES:\n        raise ConfigurationError(\"Prepared QQ notification event is not allowed\")\n    message = envelope.get(\"message\")\n    if not isinstance(message, str) or not message or len(message) > 900:\n        raise ConfigurationError(\"Prepared QQ notification message is invalid\")\n    if re.search(r\"[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]\", message):\n        raise ConfigurationError(\"Prepared QQ notification contains control characters\")\n    if re.search(r\"(?i)\\[CQ:\", message):\n        raise ConfigurationError(\"Prepared QQ notification contains a OneBot CQ code\")\n    return event_name, message\n\n\ndef _event_detail(event_name: str, action: str, payload: Mapping[str, Any]) -> str:\n    if action in {\"labeled\", \"unlabeled\"}:\n        label = payload.get(\"label\") or {}\n        return f\"标签：{_clean_text(label.get('name'), 80)}\"\n    if action in {\"assigned\", \"unassigned\"}:\n        return f\"处理人：{_login(payload.get('assignee'))}\"\n    if action in {\"milestoned\", \"demilestoned\"}:\n        milestone = payload.get(\"milestone\") or {}","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/script/github/notify_qq.py#L240-L276","documentation":"Raised by _read_prepared_message (notify_qq.py:258) when the envelope's \"event_name\" is not in COLLECTED_EVENT_NAMES (issue_comment, pull_request_review, pull_request_review_comment). Only those three events support the collect/prepare flow, so any other value is rejected to keep the relay payload bounded.","triggerScenarios":"An envelope carries an event_name outside the allowed set, e.g. \"issues\", \"release\", or a typo. This only occurs via the QQ_PREPARED_MESSAGE_PATH read path because the writer (_write_prepared_message) also validates event_name first.","commonSituations":"Hand-editing the prepared JSON; an envelope produced by an older/newer version of the script with a different allowed-event set; attempting to use the collect flow for an event that only supports live sending.","solutions":["Regenerate the envelope using a supported event (issue_comment, pull_request_review, or pull_request_review_comment).","Discard the stale QQ_PREPARED_MESSAGE_PATH artifact and re-run the collect step with the current script.","Send the notification live (without QQ_PREPARED_MESSAGE_PATH) if the event is not in the collect set."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"ALLOWED = {\"issue_comment\", \"pull_request_review\", \"pull_request_review_comment\"}\nevent = str(envelope.get(\"event_name\") or \"\")\nif event not in ALLOWED:\n    raise SystemExit(f\"event {event!r} not collectable; send live instead\")","typeGuard":"def is_collectable_event(envelope: object) -> bool:\n    return isinstance(envelope, Mapping) and envelope.get(\"event_name\") in {\n        \"issue_comment\", \"pull_request_review\", \"pull_request_review_comment\"\n    }","tryCatchPattern":null,"preventionTips":["Only use the collect/prepare flow for the three supported comment/review events.","Do not hand-edit event_name in the envelope.","Re-run collect if the allowed-event set changes between versions."],"tags":["config","github-actions","notification","validation"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}