infiniflow/ragflow · error · RuntimeError

Artifact exceeds {self.max_artifact_bytes} bytes: {path.name

Error message

Artifact exceeds {self.max_artifact_bytes} bytes: {path.name}

What it means

Raised by LocalProvider._collect_artifacts() when a single collected file's stat().st_size exceeds the configured max_artifact_bytes cap (default 10 MiB). It is checked before the extension allow-list, so an oversized file fails even with an allowed extension. The run fails during artifact collection; the file is not truncated or skipped.

Source

Thrown at agent/sandbox/providers/local.py:331

        if output_size > self.max_output_bytes:
            raise RuntimeError(f"Local execution output exceeded {self.max_output_bytes} bytes.")

    def _collect_artifacts(self, artifacts_dir: Path) -> list[dict[str, Any]]:
        artifacts: list[dict[str, Any]] = []
        for path in sorted(artifacts_dir.rglob("*")):
            if path.is_symlink():
                raise RuntimeError(f"Artifact symlinks are not allowed: {path.name}")
            if path.is_dir():
                continue
            if not path.is_file():
                raise RuntimeError(f"Unsupported artifact entry: {path.name}")

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

            size = path.stat().st_size
            if size > self.max_artifact_bytes:
                raise RuntimeError(f"Artifact exceeds {self.max_artifact_bytes} bytes: {path.name}")

            ext = path.suffix.lower()
            if ext not in ALLOWED_ARTIFACT_EXTENSIONS:
                raise RuntimeError(f"Unsupported artifact type: {path.name}")

            artifacts.append(
                {
                    "name": path.relative_to(artifacts_dir).as_posix(),
                    "content_b64": base64.b64encode(path.read_bytes()).decode("ascii"),
                    "mime_type": mimetypes.guess_type(path.name)[0] or "application/octet-stream",
                    "size": size,
                }
            )
        return artifacts

    @staticmethod
    def _normalize_language(language: str) -> str:
        lang_lower = (language or "python").lower()

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Shrink the output in the executed code: export a sample, downsample images (lower dpi), compress, or write a summary instead of full data.
  2. Raise 'max_artifact_bytes' at initialize() (schema max 104857600) if large artifacts are expected.
  3. Split oversized data across multiple files only if under max_artifacts, else aggregate to a compressed format (gzip/parquet).
  4. Communicate the artifact budget to the code-generation step via prompt or arguments.

Example fix

# before (executed code)
plt.savefig('artifacts/chart.png', dpi=300)

# after (executed code)
plt.savefig('artifacts/chart.png', dpi=110)
Defensive patterns

Strategy: try-catch

Validate before calling

# in the executed code, guard output size before finishing:
# p = Path('out.png'); assert p.stat().st_size <= MAX_ARTIFACT_BYTES or shrink()

Try / catch

try:
    result = provider.execute_code(instance_id, code, "python")
except RuntimeError as e:
    if "Artifact exceeds" in str(e):
        raise ArtifactTooLarge(str(e)) from e
    raise

Prevention

When it happens

Trigger: Executed code writing a large CSV/PNG/PDF into artifacts/ (e.g. a high-resolution matplotlib figure, full dataset export) exceeding the cap; lowering 'max_artifact_bytes' at initialize() below typical output sizes.

Common situations: Data exports of full result sets; high-DPI charts (figsize * dpi inflates PNG size); models or dataframes serialized to disk; a cap tuned for small text artifacts while the workload produces images.

Related errors


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