{"record":{"id":"b4287a0a84767909","repo":"iflytek/astron-agent","slug":"audit-input-error","errorCode":"AUDIT_INPUT_ERROR","errorMessage":"Audit result abnormal: {resp}","messagePattern":"Audit result abnormal: (.+?)","errorType":"error_code","errorClass":"CustomException","httpStatus":null,"severity":"error","filePath":"core/workflow/infra/audit_system/audit_api/iflytek/ifly_audit_api.py","lineNumber":370,"sourceCode":"        payload_resource_list = []\n        if context_list:\n            for ctx in context_list:\n                if ctx.resource_list:\n                    payload_resource_list.append(\n                        res.dict() for res in ctx.resource_list\n                    )\n                payload_context_list.append(ctx.dict())\n\n        if payload_context_list:\n            payload[\"context_list\"] = payload_context_list\n        if payload_resource_list:\n            payload[\"resource_list\"] = payload_resource_list\n\n        resp = await self._post(\n            \"/audit/v3/aichat/input\", payload, span, chat_app_id, uid\n        )\n        if resp.get(\"data\", {}).get(\"action\") != ActionEnum.NONE:\n            raise CustomException(\n                CodeEnum.AUDIT_INPUT_ERROR,\n                cause_error=f\"Audit result abnormal: {resp}\",\n            )\n\n    async def output_text(\n        self,\n        stage: Stage,\n        content: str,\n        pindex: int,\n        span: Span,\n        is_pending: Literal[0, 1],\n        is_stage_end: Literal[0, 1],\n        is_end: Literal[0, 1],\n        chat_sid: str,\n        chat_app_id: str = \"\",\n        uid: str = \"\",\n        **kwargs: Any,\n    ) -> None:","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/infra/audit_system/audit_api/iflytek/ifly_audit_api.py#L352-L388","documentation":"Raised by input_text after a successful audit request when the response's data.action is not ActionEnum.NONE — i.e. the audit service flagged the input text and returned a moderation action (block/replace/review) instead of passing it. The library treats any non-NONE action as an input policy violation and raises AUDIT_INPUT_ERROR with the full response attached.","triggerScenarios":"Calling input_text(content, chat_sid, ...) where the audit API returns code SUCCESS but data.action != NONE — the submitted user input tripped a content-safety rule.","commonSituations":"Users submitting text with sensitive/prohibited words, prompts that hit compliance rules, misconfigured audit rule packs that over-block benign content, or ActionEnum comparison mismatch after an SDK/enum version change.","solutions":["Read the response 'data' in the message to see which action and hit details the audit service returned.","Surface a friendly content-policy message to the end user and reject or sanitize the offending input.","Review the configured audit rule categories if benign content is being blocked; tune rules in the IFlyTek console.","Verify ActionEnum values match the API contract so NONE is compared correctly."],"exampleFix":"// before: treat every non-NONE action as a hard error\nif resp.get(\"data\", {}).get(\"action\") != ActionEnum.NONE:\n    raise CustomException(CodeEnum.AUDIT_INPUT_ERROR, ...)\n// after: handle blocking action gracefully in caller\ntry:\n    await audit_api.input_text(content, chat_sid, span)\nexcept CustomException as e:\n    if e.code == CodeEnum.AUDIT_INPUT_ERROR:\n        return \"Your message was blocked by content moderation.\"\n    raise","handlingStrategy":"try-catch","validationCode":"def input_precheck(content: str) -> bool:\n    return bool(content) and len(content) <= MAX_AUDIT_TEXT_LEN","typeGuard":"def audit_blocked(resp: dict) -> bool:\n    return isinstance(resp, dict) and resp.get('data', {}).get('action') not in (None, ActionEnum.NONE)","tryCatchPattern":"try:\n    await audit_api.input_text(user_input, chat_sid, span)\nexcept CustomException as e:\n    if e.code == CodeEnum.AUDIT_INPUT_ERROR:\n        return ModerationResult(blocked=True, detail=str(e))\n    raise","preventionTips":["Run a lightweight client-side word filter before submitting to the audit API","Show users a clear content-policy message instead of a raw exception","Periodically review audit rule packs to reduce false positives"],"tags":["audit","content-moderation","input-validation","policy-violation"],"backgroundTag":"content-moderation-blocked","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}