iflytek/astron-agent · warning · CustomException
SPARK_QUICK_REPAIR_ERROR
SPARK_QUICK_REPAIR_ERROR
Error message
Sensitive content detected, LLM did not find function_call field
What it means
Raised by SparkFcLLM._recv_messages when the Spark function-call response's message sid ends with '1', which per the Spark API indicates a 'quick repair' — the server-side content auditor intercepted the request and the LLM produced no function_call. The provider converts this into a SPARK_QUICK_REPAIR_ERROR stating sensitive content was detected. It is a content-compliance rejection, not a transport or code bug.
Solutions
- Treat as an expected user-content rejection: catch SPARK_QUICK_REPAIR_ERROR and return a polite 'content not allowed' response to the end user instead of retrying.
- Review the offending user input for sensitive keywords and add upstream input moderation/filtering before calling the FC LLM.
- If false positives occur, review Spark console content-audit settings/patch_id configuration and adjust the auditing parameter or escalate to iFlytek support.
- Sanitize or truncate user content (strip flagged segments) and retry once with a compliance-safe reformulation.
Example fix
// before
name, usage, args = await async_call_spark_fc(messages, functions)
// after
try:
name, usage, args = await async_call_spark_fc(messages, functions)
except CustomException as e:
if e.err_code == CodeEnum.SPARK_QUICK_REPAIR_ERROR:
return sanitize_refusal_response(messages) # content was rejected by Spark auditing
raise Defensive patterns
Strategy: try-catch
Validate before calling
SENSITIVE_HINTS = ("politics", "violence", "porn", ...) # plug in your moderation list
def screen_user_input(text: str) -> bool:
return not any(h in text.lower() for h in SENSITIVE_HINTS)
# call before async_call_spark_fc: if not screen_user_input(user_text): return refusal_response() Type guard
def is_spark_quick_repair(e: BaseException) -> bool:
return isinstance(e, CustomException) and e.err_code == CodeEnum.SPARK_QUICK_REPAIR_ERROR Try / catch
try:
name, usage, args = await async_call_spark_fc(messages, functions, span)
except CustomException as e:
if e.err_code == CodeEnum.SPARK_QUICK_REPAIR_ERROR:
return FunctionCallResult(status="content_rejected", message="Your request was blocked by content moderation")
raise # do not retry; retrying flagged content will be rejected again Prevention
- Run upstream input moderation/filtering before sending user content to Spark function calling.
- Never blindly retry this error — the same content will be flagged again; return a refusal to the user.
- Track quick-repair occurrences per user/prompt to tune false-positive thresholds with iFlytek support.
- Review the auditing parameter (parameter.chat.auditing) and patch_id configuration if legitimate traffic is being rejected.
When it happens
Trigger: Calling SparkFcLLM via async_call_spark_fc with user/assistant message content that Spark's auditing flags as sensitive; the final received frame's header.sid[-1] == '1' triggers the check at spark_fc_llm.py:115 before function_call extraction.
Common situations: End users submitting politically sensitive, violent, or otherwise policy-violating prompts in a tool-calling workflow; prompts containing sensitive keywords in Chinese regulatory context; audit level 'default' in the payload's parameter.chat.auditing being strict for the deployment region.
Related errors
- SPARK_FUNCTION_NOT_CHOICE_ERROR
- SPARK_REQUEST_ERROR
- PERSONALITY_AI_GENERATE_ERROR
- MODEL_CHECK_FAILED
- MODEL_NOT_EXIST
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/f011fa64e88ca46b.
Report an issue: GitHub.
Appendix: source
Thrown at core/workflow/infra/providers/llm/iflytek_spark/spark_fc_llm.py:116
:return: Tuple containing (function_name, token_usage, arguments)
"""
while True:
try:
msg = json.loads(await ws_handle.recv())
await span.add_info_events_async(
{"function_call_recv": json.dumps(msg, ensure_ascii=False)}
)
code = msg["header"]["code"]
if code != 0:
raise CustomException(
err_code=CodeConvert.sparkCode(code),
cause_error=json.dumps(msg, ensure_ascii=False),
)
status = msg["header"]["status"]
llm_service_sid = msg["header"]["sid"]
# Check if it's a quick repair: if the last character of sid is '1', it's a quick repair
if llm_service_sid[-1] == "1":
raise CustomException(
err_code=CodeEnum.SPARK_QUICK_REPAIR_ERROR,
err_msg="Sensitive content detected, LLM did not find function_call field",
cause_error="Sensitive content detected, LLM did not find function_call field",
)
if status != 2:
continue
token_usage = msg["payload"]["usage"]["text"]
if "function_call" not in msg["payload"]["choices"]["text"][0]:
raise CustomException(
err_code=CodeEnum.SPARK_FUNCTION_NOT_CHOICE_ERROR,
err_msg="Cannot find function_call field in LLM response",
cause_error="Cannot find function_call field in LLM response",
)
name = msg["payload"]["choices"]["text"][0]["function_call"]["name"]
arguments = msg["payload"]["choices"]["text"][0]["function_call"][
"arguments"
]View on GitHub (pinned to 5e758547a8)