iflytek/astron-agent · error · ValueError

Unsupported content type for input review

Error message

Unsupported content type for input review

What it means

TextStrategy.input_review dispatches on the input frame's content type and only supports the content types it explicitly handles (text-like inputs). When the frame's content type matches none of the known branches, it raises ValueError('Unsupported content type for input review'). The library throws this to signal that the selected strategy cannot audit that input content type.

Solutions

  1. Fix strategy selection so non-text frames are routed to a strategy that supports their content type
  2. Add an elif branch (or handler) for the new content type in TextStrategy.input_review if the text strategy should handle it
  3. Log the actual content_type value in the exception message to speed up diagnosis
  4. Add an explicit allowlist check of supported content types before dispatch

Example fix

// before (text_strategy.py)
        else:
            raise ValueError("Unsupported content type for input review")

// after
        else:
            raise ValueError(
                f"Unsupported content type for input review: {input_frame.content_type!r}"
            )
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {"text", "rich_text"}  # content types TextStrategy.input_review handles
if input_frame.content_type not in SUPPORTED:
    raise ValueError(f"TextStrategy cannot review content_type={input_frame.content_type!r}")

Type guard

def is_text_frame(frame) -> bool:
    return getattr(frame, "content_type", None) in ("text", "rich_text")

Try / catch

try:
    await strategy.input_review(input_frame, span)
except ValueError as e:
    if "Unsupported content type" in str(e):
        logger.error("content_type=%s misrouted to %s", input_frame.content_type, type(strategy).__name__)
    raise

Prevention

When it happens

Trigger: An InputFrameAudit whose content type is not one of the branches handled by TextStrategy reaches TextStrategy.input_review — e.g. an image/audio/media frame routed to the text strategy, or a new content type added upstream without updating the strategy's dispatch chain.

Common situations: Strategy-selection code maps a content type to TextStrategy by default/fallthrough; a new InputFrame content type was introduced elsewhere in the audit system without extending TextStrategy's if/elif chain; a misconfigured pipeline assigns frames of the wrong modality to the text strategy.

Related errors


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

Appendix: source

Thrown at core/workflow/infra/audit_system/strategy/text_strategy.py:47

        :param input_frame: Input frame containing text content to be audited
        :param span: Span object for tracking request context information
        :return: None
        """
        # Text content audit
        if input_frame.content_type == ContentType.TEXT:
            for audit_api in self.audit_apis:
                # Call audit API for content review
                await audit_api.input_text(
                    content=input_frame.content,
                    chat_sid=self.context.chat_sid,
                    span=span,
                    chat_app_id=self.context.chat_app_id,
                    uid=self.context.uid,
                    template_id=self.context.template_id,
                    context_list=input_frame.context_list,
                )
        else:
            raise ValueError("Unsupported content type for input review")

    async def output_review(self, output_frame: OutputFrameAudit, span: Span) -> None:
        """
        Text output review logic, divided into first sentence audit and sentence-by-sentence audit.

        :param output_frame: Output frame containing content to be audited
        :param span: Span object for tracking request context information
        :return: None
        """

        if not self.context.last_content_stage:
            self.context.last_content_stage = output_frame.stage

        if self.context.last_content_stage == output_frame.stage:
            self.context.remaining_content += output_frame.content

        self.context.add_source_content(output_frame)

View on GitHub (pinned to 5e758547a8)