iflytek/astron-agent · critical · InvalidConfigException

Invalid task creation URL

Error message

Invalid task creation URL: {task_create_url}

What it means

create_task reads the Xiaowu RPA task-creation endpoint from the environment variable XIAOWU_RPA_TASK_CREATE_URL_KEY and validates it with is_valid_url before use. If the variable is unset, None, empty, or not a valid URL, InvalidConfigException('Invalid task creation URL: ...') is raised after logging the same message.

Solutions

  1. Set XIAOWU_RPA_TASK_CREATE_URL_KEY to a full valid URL, e.g. http://rpa-backend:8080/api/v1/tasks
  2. Check the deployment config (docker-compose env, Kubernetes ConfigMap/Secret, .env) actually injects the variable into the plugin container
  3. Verify the value includes scheme and host and passes is_valid_url; restart the service after changing env
  4. Confirm the constant XIAOWU_RPA_TASK_CREATE_URL_KEY matches the key actually configured in your environment

Example fix

// before
XIAOWU_RPA_TASK_CREATE_URL_KEY=rpa/task/create  # no scheme -> invalid
// after
XIAOWU_RPA_TASK_CREATE_URL_KEY=http://rpa-backend:8080/api/v1/rpa/task/create
Defensive patterns

Strategy: validation

Validate before calling

import os
from urllib.parse import urlparse
def task_create_url_ok() -> bool:
    url = os.getenv("XIAOWU_RPA_TASK_CREATE_URL_KEY")
    if not url:
        return False
    p = urlparse(url)
    return p.scheme in ("http", "https") and bool(p.netloc)

Try / catch

try:
    task_id = create_task(access_token, ...)
except InvalidConfigException as e:
    logger.critical("RPA config missing: %s", e)
    raise SystemExit(1)  # fail fast at startup instead

Prevention

When it happens

Trigger: Calling create_task when the env var XIAOWU_RPA_TASK_CREATE_URL_KEY is not set (task_create_url is None) or set to a malformed value like 'xiaowu-api/task' (no scheme/host).

Common situations: Deployment missing the RPA configuration in .env/compose/Helm values; config key renamed or typo'd between services; URL lacking scheme (http://) after manual editing; migrating environments where the secret/config map wasn't copied.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at core/plugin/rpa/infra/xiaowu/tasks.py:31


# Create task
async def create_task(
    access_token: str,
    project_id: str,
    version: Optional[int],
    phone_number: Optional[str],
    exec_position: Optional[str],
    params: Optional[dict],
) -> str:
    """
    Create task.
    - Return task ID.
    """
    task_create_url = os.getenv(const.XIAOWU_RPA_TASK_CREATE_URL_KEY, None)
    if not is_valid_url(task_create_url):
        logger.error(f"Invalid task creation URL: {task_create_url}")
        raise InvalidConfigException(f"Invalid task creation URL: {task_create_url}")

    header = {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {access_token}",
    }
    body: Dict[str, Optional[Union[str, dict, int]]] = {
        "project_id": project_id,
        "exec_position": exec_position,
        "params": params,
    }
    if version:
        body["version"] = version

    if phone_number:
        body["phone_number"] = phone_number

    async with httpx.AsyncClient() as client:
        try:

View on GitHub (pinned to 5e758547a8)