iflytek/astron-agent · error · ServiceException

ServiceParamsError

ServiceParamsError

Error message

讯飞开放平台 is not configured. Please configure it in Platform Account Management first.

What it means

ServiceParamsError from get_iflytek_open_platform_credentials means no iFlytek Open Platform credentials could be loaded from Redis or the database, or the stored config failed parsing. Every iFlytek-dependent service (image gen, OCR, TTS, ISE, image understanding) calls this first and fails fast.

Solutions

  1. Configure the 讯飞开放平台 credentials in Platform Account Management (console UI) and retry.
  2. Verify the Redis key / database row holding the credentials exists and is non-empty.
  3. Check that you are operating in the correct tenant/space where credentials were saved.
  4. Confirm app_id, api_key, and api_secret are all present in the stored config so parsing succeeds.
Defensive patterns

Strategy: validation

Validate before calling

async def iflytek_configured() -> bool:
    from core.plugin.aitools.platform_account_config import _load_from_redis, _load_from_database, _parse_credentials
    return _parse_credentials(_load_from_redis() or _load_from_database()) is not None

Try / catch

try:
    creds = get_iflytek_open_platform_credentials()
except ServiceException as e:
    return error_response('讯飞开放平台 not configured; set credentials in Platform Account Management', 400)

Prevention

When it happens

Trigger: Calling any iflytek service function when no credentials row exists in the database, the Redis cache is empty, or _parse_credentials returns None due to missing/blank app_id/api_key/api_secret fields.

Common situations: Fresh deployment where Platform Account Management was never configured, wrong tenant/space so the config lookup returns nothing, Redis flushed or database migration not run, partially saved credentials.

Related errors


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

Appendix: source

Thrown at core/plugin/aitools/platform_account_config.py:29

IFLYTEK_OPEN_PLATFORM_CACHE_KEY = "platform_account_text:iflytek_open_platform"
PLATFORM_ACCOUNT_CATEGORY = "PLATFORM_ACCOUNT"
IFLYTEK_OPEN_PLATFORM_CODE = "IFLYTEK_OPEN_PLATFORM"

_REDIS_CLIENT = None


@dataclass(frozen=True)
class IflytekOpenPlatformCredentials:
    app_id: str
    api_key: str
    api_secret: str


def get_iflytek_open_platform_credentials() -> IflytekOpenPlatformCredentials:
    raw_config = _load_from_redis() or _load_from_database()
    credentials = _parse_credentials(raw_config)
    if credentials is None:
        raise ServiceException.from_error_code(
            CodeEnums.ServiceParamsError,
            extra_message=(
                "讯飞开放平台 is not configured. "
                "Please configure it in Platform Account Management first."
            ),
        )
    return credentials


def get_iflytek_open_platform_app_id(default: str = "") -> str:
    try:
        return get_iflytek_open_platform_credentials().app_id
    except ServiceException:
        return default


def _load_from_redis() -> Optional[str]:
    try:

View on GitHub (pinned to 5e758547a8)