infiniflow/ragflow · error · RuntimeError

Unsupported artifact type: {path.name}

Error message

Unsupported artifact type: {path.name}

What it means

Raised by LocalProvider._collect_artifacts() when a collected file's lowercase extension is not in ALLOWED_ARTIFACT_EXTENSIONS ({.csv, .html, .jpeg, .jpg, .json, .pdf, .png, .svg}). Files with any other extension (e.g. .txt, .parquet, .xlsx, .py, extensionless) cause the whole run to fail during artifact collection.

Source

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

        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()
        if lang_lower in {"python", "python3"}:
            return "python"
        if lang_lower in {"javascript", "nodejs"}:
            return "nodejs"

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Write artifacts with an allowed extension: rename .txt to .html/.csv/.json as appropriate, save figures as .png/.svg, tables as .csv/.json.
  2. For arbitrary binary payloads, wrap in JSON (base64) or emit a PDF/CSV container.
  3. If you own the deployment and need more types, extend ALLOWED_ARTIFACT_EXTENSIONS in agent/sandbox/providers/local.py — but keep the risk of unbounded types in mind.
  4. Put non-artifact intermediate files outside the artifacts directory (they are not scanned).

Example fix

# before (executed code)
Path('artifacts/report.txt').write_text(text)

# after (executed code)
Path('artifacts/report.html').write_text(f'<pre>{text}</pre>')
Defensive patterns

Strategy: type-guard

Validate before calling

from agent.sandbox.providers.local import ALLOWED_ARTIFACT_EXTENSIONS

def has_allowed_artifact_extensions(artifact_names: list[str]) -> bool:
    from pathlib import Path
    return all(Path(n).suffix.lower() in ALLOWED_ARTIFACT_EXTENSIONS for n in artifact_names)

Type guard

ALLOWED = {'.csv', '.html', '.jpeg', '.jpg', '.json', '.pdf', '.png', '.svg'}

def is_allowed_artifact_name(name: str) -> bool:
    """True when LocalProvider will collect this artifact filename."""
    from pathlib import Path
    return Path(name).suffix.lower() in ALLOWED

Try / catch

try:
    result = provider.execute_code(instance_id, code, "python")
except RuntimeError as e:
    if "Unsupported artifact type" in str(e):
        raise BadArtifactType(str(e)) from e
    raise

Prevention

When it happens

Trigger: Executed code writing artifacts/plain.txt, results.parquet, model.pkl, or an extensionless file into artifacts/. Case-insensitive: .PNG is fine, .Png fine; .txt is not.

Common situations: LLM-generated code writing logs or reports as .txt by habit; dataframe.to_excel producing .xlsx; pickle joblib artifacts; assuming the collector accepts any file.

Related errors


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