{"record":{"id":"5f9e7428ccca1e34","repo":"iflytek/astron-agent","slug":"invalid-task-creation-url-task-create-url","errorCode":null,"errorMessage":"Invalid task creation URL: {task_create_url}","messagePattern":"Invalid task creation URL: (.+?)","errorType":"exception","errorClass":"InvalidConfigException","httpStatus":null,"severity":"critical","filePath":"core/plugin/rpa/infra/xiaowu/tasks.py","lineNumber":31,"sourceCode":"\n\n# Create task\nasync def create_task(\n    access_token: str,\n    project_id: str,\n    version: Optional[int],\n    phone_number: Optional[str],\n    exec_position: Optional[str],\n    params: Optional[dict],\n) -> str:\n    \"\"\"\n    Create task.\n    - Return task ID.\n    \"\"\"\n    task_create_url = os.getenv(const.XIAOWU_RPA_TASK_CREATE_URL_KEY, None)\n    if not is_valid_url(task_create_url):\n        logger.error(f\"Invalid task creation URL: {task_create_url}\")\n        raise InvalidConfigException(f\"Invalid task creation URL: {task_create_url}\")\n\n    header = {\n        \"Content-Type\": \"application/json\",\n        \"Authorization\": f\"Bearer {access_token}\",\n    }\n    body: Dict[str, Optional[Union[str, dict, int]]] = {\n        \"project_id\": project_id,\n        \"exec_position\": exec_position,\n        \"params\": params,\n    }\n    if version:\n        body[\"version\"] = version\n\n    if phone_number:\n        body[\"phone_number\"] = phone_number\n\n    async with httpx.AsyncClient() as client:\n        try:","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/plugin/rpa/infra/xiaowu/tasks.py#L13-L49","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Set XIAOWU_RPA_TASK_CREATE_URL_KEY to a full valid URL, e.g. http://rpa-backend:8080/api/v1/tasks","Check the deployment config (docker-compose env, Kubernetes ConfigMap/Secret, .env) actually injects the variable into the plugin container","Verify the value includes scheme and host and passes is_valid_url; restart the service after changing env","Confirm the constant XIAOWU_RPA_TASK_CREATE_URL_KEY matches the key actually configured in your environment"],"exampleFix":"// before\nXIAOWU_RPA_TASK_CREATE_URL_KEY=rpa/task/create  # no scheme -> invalid\n// after\nXIAOWU_RPA_TASK_CREATE_URL_KEY=http://rpa-backend:8080/api/v1/rpa/task/create","handlingStrategy":"validation","validationCode":"import os\nfrom urllib.parse import urlparse\ndef task_create_url_ok() -> bool:\n    url = os.getenv(\"XIAOWU_RPA_TASK_CREATE_URL_KEY\")\n    if not url:\n        return False\n    p = urlparse(url)\n    return p.scheme in (\"http\", \"https\") and bool(p.netloc)","typeGuard":null,"tryCatchPattern":"try:\n    task_id = create_task(access_token, ...)\nexcept InvalidConfigException as e:\n    logger.critical(\"RPA config missing: %s\", e)\n    raise SystemExit(1)  # fail fast at startup instead","preventionTips":["Validate required RPA env vars at service startup, not per-request","Include scheme and host in all configured URLs","Keep env keys consistent across docker-compose/K8s manifests and the code constants"],"tags":["config","env-var","rpa","xiaowu"],"backgroundTag":"missing-env-var","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}