iflytek/astron-agent · error · CustomException

AUDIT_INPUT_ERROR

AUDIT_INPUT_ERROR

Error message

Audit result abnormal: {resp}

What it means

MockAuditAPI.input_text raises CustomException(CodeEnum.AUDIT_INPUT_ERROR, 'Audit result abnormal: {resp}') when the mock audit service response for user input text (/audit/v3/aichat/input) returns data.action != ActionEnum.NONE. In this API, action NONE means 'content passed'; any other action (block/review/replace) is treated as an abnormal audit result and surfaces as this error. The message embeds the full response for diagnosis.

Solutions

  1. Inspect the embedded resp in the error message (and the logged response) to see data.action and the reason; fix the offending content or policy that triggered the block.
  2. If the content is legitimate, review the audit template/policy configuration (template_id, app policy) that classified it as unsafe.
  3. Verify the mock/audit backend configuration: if the simulated service is set to always return a non-NONE action, correct it to return ActionEnum.NONE for passing content.
  4. Handle CustomException with code AUDIT_INPUT_ERROR in the chat entrypoint and return a friendly 'content violates policy' response to the user instead of a 500.

Example fix

# before
await audit_api.input_text(user_input, chat_sid, span)

# after
try:
    await audit_api.input_text(user_input, chat_sid, span)
except CustomException as e:
    if e.code == CodeEnum.AUDIT_INPUT_ERROR:
        return policy_violation_response(e)
    raise
Defensive patterns

Strategy: try-catch

Validate before calling

if contains_sensitive_terms(user_input) or not user_input.strip():
    return pre_rejected_policy_response()

Type guard

def audit_passed(resp: dict) -> bool:
    return isinstance(resp, dict) and resp.get("data", {}).get("action") == ActionEnum.NONE

Try / catch

try:
    await audit_api.input_text(content, chat_sid, span, chat_app_id=app_id, uid=uid)
except CustomException as e:
    if e.code == CodeEnum.AUDIT_INPUT_ERROR:
        logger.warning("Input audit rejected: %s", e.cause_error)
        return policy_violation_response()
    raise

Prevention

When it happens

Trigger: Calling MockAuditAPI.input_text(content, chat_sid, span, ...) with content (or context_list history) that the audit backend flags: the mocked/simulated backend returns data.action other than NONE, e.g. action=block for sensitive user input.

Common situations: Users submit policy-violating prompts (politics, pornography, sensitive words) in a chat whose audit backend — even the mock — flags the input; a misconfigured audit template_id maps benign text to a blocking policy; the mock upstream service is configured to always return a non-NONE action, breaking every request.

Related errors


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

Appendix: source

Thrown at core/workflow/infra/audit_system/audit_api/mock/mock_audit_api.py:181

        payload_context_list = []
        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
                    )
                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, chat_app_id, uid)
        if resp.get("data", {}).get("action") != ActionEnum.NONE:
            raise CustomException(
                CodeEnum.AUDIT_INPUT_ERROR,
                cause_error=f"Audit result abnormal: {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:

View on GitHub (pinned to 5e758547a8)