iflytek/astron-agent · error · RuntimeError

Skill resource is unavailable

Error message

Skill resource is unavailable

What it means

_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.

Solutions

  1. Reduce the number of resources in the request below MAX_SKILL_RESOURCE_COUNT
  2. Bundle multiple files into a single archive and attach it as one resource
  3. Filter/deduplicate the resource list before building the request
  4. If the platform limit is genuinely too low, raise MAX_SKILL_RESOURCE_COUNT consciously, accepting the added load

Example fix

// before
resources = [make_resource(p) for p in all_files]  # 50 files
// after
resources = [make_resource(p) for p in all_files][:MAX_SKILL_RESOURCE_COUNT]
Defensive patterns

Strategy: validation

Validate before calling

if len(resources) > MAX_SKILL_RESOURCE_COUNT:
    raise ValueError(f'too many resources: {len(resources)} > {MAX_SKILL_RESOURCE_COUNT}')

Try / catch

try:
    result = await provider.execute(request)
except RuntimeError as e:
    if 'Skill resource is unavailable' in str(e):
        request.resources = request.resources[:MAX_SKILL_RESOURCE_COUNT]
        result = await provider.execute(request)
    else:
        raise

Prevention

When it happens

Trigger: Submitting a SandboxExecutionRequest whose resources list contains more entries than MAX_SKILL_RESOURCE_COUNT.

Common situations: 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.

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at core/agent/service/plugin/skill_sandbox.py:617

                "stderr": stderr,
                "artifacts": await self._collect_artifacts(
                    sandbox,
                    workspace,
                    self._join_workspace(workspace, request.output_dir),
                    request,
                    execution_timeout,
                ),
            }
        finally:
            await sandbox.kill()

    async def _stage_resources(
        self, sandbox: Any, workspace: str, resources: list[Any]
    ) -> None:
        staged: list[tuple[str, str, int]] = []
        declared_total = 0
        if len(resources) > MAX_SKILL_RESOURCE_COUNT:
            raise RuntimeError(SKILL_RESOURCE_ERROR)
        for resource in resources:
            path = self._safe_resource_path(getattr(resource, "path", ""))
            download_url = str(getattr(resource, "download_url", "") or "")
            try:
                declared_size = int(getattr(resource, "file_size", 0) or 0)
                trusted_url = validate_skill_resource_url(download_url)
            except (TypeError, ValueError, RuntimeError):
                raise RuntimeError(SKILL_RESOURCE_ERROR) from None
            if (
                not path
                or declared_size < 0
                or declared_size > MAX_SKILL_RESOURCE_BYTES
                or declared_total + declared_size > MAX_SKILL_RESOURCE_TOTAL_BYTES
            ):
                raise RuntimeError(SKILL_RESOURCE_ERROR)
            declared_total += declared_size
            staged.append((path, trusted_url, declared_size))

View on GitHub (pinned to 5e758547a8)