iflytek/astron-agent · warning · AuditServiceException

9022

9022

Error message

审核结果异常: {resp}

What it means

After a successful input-text audit call (`/audit/v3/aichat/input`), the client expects `data.action` to equal `ActionEnum.NONE` (content passed moderation). Any other action (block/review/pass-with-modification) raises `AuditServiceException(*c9022)` with '审核结果异常: {resp}'.

Solutions

  1. Inspect `resp` in the exception to see which category triggered and adjust the user prompt.
  2. Review moderation category sensitivity settings on the audit platform if false positives occur.
  3. Handle the audit-block path gracefully in the calling chat flow (return a policy message instead of a raw 500).
  4. Confirm chat_app_id is mapped to the intended moderation policy.
Defensive patterns

Strategy: try-catch

Type guard

def audit_passed(resp: dict) -> bool:
    from common.audit_system.audit_api.iflytek.ifly_audit_api import ActionEnum
    return resp.get("data", {}).get("action") == ActionEnum.NONE

Try / catch

try:
    await audit_api.input_text(...)
except AuditServiceException as e:
    # resp payload shows flagged category; respond with a moderation notice
    return ModerationBlockedResponse(detail=str(e))

Prevention

When it happens

Trigger: `input_text` gets a response where `resp["data"]["action"] != ActionEnum.NONE`, i.e., the audited user input was flagged by content moderation.

Common situations: End users submitting sensitive/prohibited text to a chat agent; over-strict moderation policy on the audit platform; audit category configuration changed vendor-side.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/d9a60452d97d9485. Report an issue: GitHub.

Appendix: source

Thrown at core/common/audit_system/audit_api/iflytek/ifly_audit_api.py:226

        payload_resource_list = []
        if context_list:
            for ctx in context_list:
                if ctx.resource_list:
                    payload_resource_list.append(
                        res.dict() for res in ctx.resource_list  # type: ignore[attr-defined]
                    )
                payload_context_list.append(ctx.dict())

        if payload_context_list:
            payload["context_list"] = payload_context_list
        if payload_resource_list:
            payload["resource_list"] = payload_resource_list

        resp = await self._post(
            "/audit/v3/aichat/input", payload, span, chat_app_id, uid
        )
        if resp.get("data", {}).get("action") != ActionEnum.NONE:
            raise AuditServiceException(*c9022)(f"审核结果异常: {resp}")

    async def output_text(
        self,
        stage: Stage,
        content: str,
        pindex: int,
        span: Span,
        is_pending: Literal[0, 1],
        is_stage_end: Literal[0, 1],
        is_end: Literal[0, 1],
        chat_sid: str,
        chat_app_id: str = "",
        uid: str = "",
        **kwargs: Any,
    ) -> None:
        payload = {
            "intention": "dialog",
            "stage": stage.value,

View on GitHub (pinned to 5e758547a8)