{"record":{"id":"506c1b88d305bdf9","repo":"iflytek/astron-agent","slug":"skill-resource-is-unavailable-sandbox","errorCode":null,"errorMessage":"Skill resource is unavailable","messagePattern":"Skill resource is unavailable","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"core/agent/service/plugin/skill_sandbox.py","lineNumber":617,"sourceCode":"                \"stderr\": stderr,\n                \"artifacts\": await self._collect_artifacts(\n                    sandbox,\n                    workspace,\n                    self._join_workspace(workspace, request.output_dir),\n                    request,\n                    execution_timeout,\n                ),\n            }\n        finally:\n            await sandbox.kill()\n\n    async def _stage_resources(\n        self, sandbox: Any, workspace: str, resources: list[Any]\n    ) -> None:\n        staged: list[tuple[str, str, int]] = []\n        declared_total = 0\n        if len(resources) > MAX_SKILL_RESOURCE_COUNT:\n            raise RuntimeError(SKILL_RESOURCE_ERROR)\n        for resource in resources:\n            path = self._safe_resource_path(getattr(resource, \"path\", \"\"))\n            download_url = str(getattr(resource, \"download_url\", \"\") or \"\")\n            try:\n                declared_size = int(getattr(resource, \"file_size\", 0) or 0)\n                trusted_url = validate_skill_resource_url(download_url)\n            except (TypeError, ValueError, RuntimeError):\n                raise RuntimeError(SKILL_RESOURCE_ERROR) from None\n            if (\n                not path\n                or declared_size < 0\n                or declared_size > MAX_SKILL_RESOURCE_BYTES\n                or declared_total + declared_size > MAX_SKILL_RESOURCE_TOTAL_BYTES\n            ):\n                raise RuntimeError(SKILL_RESOURCE_ERROR)\n            declared_total += declared_size\n            staged.append((path, trusted_url, declared_size))\n","sourceCodeStart":599,"sourceCodeEnd":635,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/agent/service/plugin/skill_sandbox.py#L599-L635","documentation":"_stage_resources enforces a hard cap on the number of resources attached to a skill run; when len(resources) exceeds MAX_SKILL_RESOURCE_COUNT it raises RuntimeError(SKILL_RESOURCE_ERROR) ('Skill resource is unavailable') before any download starts.","triggerScenarios":"Submitting a SandboxExecutionRequest whose resources list contains more entries than MAX_SKILL_RESOURCE_COUNT.","commonSituations":"Workflow nodes aggregating many generated files as resources; a loop that appends one resource per item without a cap; misconfigured node passing an entire directory listing as resources.","solutions":["Reduce the number of resources in the request below MAX_SKILL_RESOURCE_COUNT","Bundle multiple files into a single archive and attach it as one resource","Filter/deduplicate the resource list before building the request","If the platform limit is genuinely too low, raise MAX_SKILL_RESOURCE_COUNT consciously, accepting the added load"],"exampleFix":"// before\nresources = [make_resource(p) for p in all_files]  # 50 files\n// after\nresources = [make_resource(p) for p in all_files][:MAX_SKILL_RESOURCE_COUNT]","handlingStrategy":"validation","validationCode":"if len(resources) > MAX_SKILL_RESOURCE_COUNT:\n    raise ValueError(f'too many resources: {len(resources)} > {MAX_SKILL_RESOURCE_COUNT}')","typeGuard":null,"tryCatchPattern":"try:\n    result = await provider.execute(request)\nexcept RuntimeError as e:\n    if 'Skill resource is unavailable' in str(e):\n        request.resources = request.resources[:MAX_SKILL_RESOURCE_COUNT]\n        result = await provider.execute(request)\n    else:\n        raise","preventionTips":["Cap resource lists at build time in workflow nodes","Bundle many files into one archive resource","Deduplicate resources before attaching","Document MAX_SKILL_RESOURCE_COUNT for workflow authors"],"tags":["sandbox","resources","limit","validation"],"backgroundTag":"payload-too-large","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}