infiniflow/ragflow · error · RuntimeError

Artifact exceeds {self.max_artifact_bytes} bytes: {relative_

Error message

Artifact exceeds {self.max_artifact_bytes} bytes: {relative_path}

What it means

Raised during artifact collection when a single artifact file's entry.size exceeds max_artifact_bytes (default 10 MiB). The provider refuses to read_bytes() and base64-encode oversized files into the execution result.

Source

Thrown at agent/sandbox/providers/tenki.py:476

        for entry in sorted(entries, key=lambda item: item.path):
            name = posixpath.basename(entry.path)
            remote_path = posixpath.join(current_dir, name)
            relative_path = posixpath.join(relative_dir, name) if relative_dir else name

            # Reject symlinks. `is_symlink` is not populated by every SDK
            # release, so also inspect the stat mode bits as the reliable check.
            if getattr(entry, "is_symlink", False) or stat.S_ISLNK(entry.mode or 0):
                raise RuntimeError(f"Artifact symlinks are not allowed: {relative_path}")
            if entry.is_dir:
                self._collect_artifacts_recursive(sandbox, remote_path, relative_path, artifacts, depth + 1)
                continue

            if len(artifacts) >= self.max_artifacts:
                raise RuntimeError(f"Tenki execution produced more than {self.max_artifacts} artifacts.")

            size = int(entry.size or 0)
            if size > self.max_artifact_bytes:
                raise RuntimeError(f"Artifact exceeds {self.max_artifact_bytes} bytes: {relative_path}")

            ext = os.path.splitext(name)[1].lower()
            if ext not in ALLOWED_ARTIFACT_EXTENSIONS:
                raise RuntimeError(f"Unsupported artifact type: {relative_path}")

            content = sandbox.fs.read_bytes(remote_path)
            artifacts.append(
                {
                    "name": relative_path,
                    "content_b64": base64.b64encode(content).decode("ascii"),
                    "mime_type": mimetypes.guess_type(name)[0] or "application/octet-stream",
                    "size": size,
                }
            )

    def _safe_terminate(self, sandbox) -> None:
        # Best-effort: max_lifetime reclaims the sandbox if this fails.
        try:

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Reduce the file: sample/filter the data, compress images, or split into chunks within the cap.
  2. Raise max_artifact_bytes in initialize() if large artifacts are expected and downstream consumers can handle the base64 payload (~1.33x size).
  3. Keep oversized data in the sandbox and return only a path/summary, transferring via another channel if needed.

Example fix

# before
# script: df.to_csv('artifacts/full_export.csv')  # 500MB

# after
# config: max_artifact_bytes = 52428800
# script: df.sample(100000).to_csv('artifacts/sample.csv')
Defensive patterns

Strategy: validation

Validate before calling

# in generated code, check size before finishing:
# for p in pathlib.Path('artifacts').rglob('*'):
#     assert p.stat().st_size <= provider.max_artifact_bytes, p

Try / catch

try:
    result = provider.execute_code(instance_id, code)
except RuntimeError as exc:
    if "Artifact exceeds" in str(exc):
        result = provider.execute_code(instance_id, sampled_or_compressed_version(code))
    else:
        raise

Prevention

When it happens

Trigger: Script saves a large output file into artifacts/ — a big DataFrame CSV, a high-resolution PNG, a generated PDF — whose on-disk size is over the configured cap.

Common situations: Data-analysis code exporting full datasets, high-DPI plots, or max_output_bytes-style tuning done on the wrong knob (this cap is per-file, not per-stream).

Related errors


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/9fbcfdc7fa3178b7. Report an issue: GitHub.