infiniflow/ragflow · error · SandboxProviderConfigError

SANDBOX_LOCAL_MAX_ARTIFACTS must be greater than or equal to

Error message

SANDBOX_LOCAL_MAX_ARTIFACTS must be greater than or equal to 0.

What it means

Raised by LocalProvider._validate_limits() during initialize() when 'max_artifacts' is negative. Unlike the other limits, 0 is allowed (disables artifact collection entirely) because the check is self.max_artifacts < 0; only negative counts are rejected with SandboxProviderConfigError. Default is 20 files.

Source

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

                "type": "integer",
                "required": False,
                "default": 10485760,
                "label": "Max Artifact Size (bytes)",
                "description": "Maximum size of a single artifact file. Unit: bytes.",
                "min": 1024,
                "max": 104857600,
            },
        }

    def _validate_limits(self) -> None:
        if self.timeout <= 0:
            raise SandboxProviderConfigError("SANDBOX_LOCAL_TIMEOUT must be greater than 0.")
        if self.max_memory_mb <= 0:
            raise SandboxProviderConfigError("SANDBOX_LOCAL_MAX_MEMORY_MB must be greater than 0.")
        if self.max_output_bytes <= 0:
            raise SandboxProviderConfigError("SANDBOX_LOCAL_MAX_OUTPUT_BYTES must be greater than 0.")
        if self.max_artifacts < 0:
            raise SandboxProviderConfigError("SANDBOX_LOCAL_MAX_ARTIFACTS must be greater than or equal to 0.")
        if self.max_artifact_bytes <= 0:
            raise SandboxProviderConfigError("SANDBOX_LOCAL_MAX_ARTIFACT_BYTES must be greater than 0.")

    def _prepare_script(self, instance_dir: Path, language: str, code: str, args_json: str) -> tuple[list[str], Path]:
        if language == "python":
            script_path = instance_dir / "main.py"
            script_path.write_text(build_python_wrapper(code, args_json), encoding="utf-8")
            return [self.python_bin, str(script_path)], script_path
        if language in {"javascript", "nodejs"}:
            script_path = instance_dir / "main.js"
            script_path.write_text(build_javascript_wrapper(code, args_json), encoding="utf-8")
            return [self.node_bin, str(script_path)], script_path
        raise RuntimeError(f"Unsupported language for local provider: {language}")

    def _build_child_env(self, instance_dir: Path) -> dict[str, str]:
        env = {
            "HOME": str(instance_dir),
            "MPLBACKEND": "Agg",

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Set 'max_artifacts' to 0 or a positive count (e.g. 20, the default).
  2. Use 0 explicitly if you intend to disable artifact collection.
  3. For 'collect everything', set the schema maximum (100) rather than a negative sentinel.
  4. Check the upstream config source for a -1 default and change it.

Example fix

// before
provider.initialize({"max_artifacts": -1})

// after
provider.initialize({"max_artifacts": 20})
Defensive patterns

Strategy: validation

Validate before calling

def valid_artifact_count(config: dict) -> bool:
    return int(config.get("max_artifacts", 20)) >= 0

Try / catch

try:
    provider.initialize(config)
except SandboxProviderConfigError as e:
    if "SANDBOX_LOCAL_MAX_ARTIFACTS" in str(e):
        config["max_artifacts"] = 20
        provider.initialize(config)
    else:
        raise

Prevention

When it happens

Trigger: Calling initialize({'max_artifacts': -1}) or any negative value. Values 0 and above pass; the count is enforced per-run in _collect_artifacts() when the artifacts directory contains more files than the cap.

Common situations: Using -1 as an 'unlimited' sentinel common in other libraries; arithmetic on the config (e.g. max_artifacts - extra) that can go negative; misconfigured UI/state field defaulting to -1.

Related errors


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