infiniflow/ragflow · error · SandboxProviderConfigError
SANDBOX_LOCAL_MAX_MEMORY_MB must be greater than 0.
Error message
SANDBOX_LOCAL_MAX_MEMORY_MB must be greater than 0.
What it means
Raised by LocalProvider._validate_limits() during initialize() when 'max_memory_mb' is zero or negative. The value is applied as an address-space rlimit (RLIMIT_AS) on the spawned child process via _limit_child_process, so a non-positive limit is rejected at configuration time with SandboxProviderConfigError. Default is 512 MB.
Source
Thrown at agent/sandbox/providers/local.py:262
"min": 0,
"max": 100,
},
"max_artifact_bytes": {
"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}")
View on GitHub (pinned to 554fb1133a)
Solutions
- Set 'max_memory_mb' to a positive MB value (e.g. 512, the default) in the initialize() config.
- Omit the key to use the 512 MB default.
- Verify the upstream env/config variable that feeds max_memory_mb and ensure it is expressed in megabytes, not bytes.
- If the workload genuinely needs no cap, still set a large positive value (e.g. 65536, the schema max) — 0 is not accepted.
Example fix
// before
provider.initialize({"max_memory_mb": 0})
// after
provider.initialize({"max_memory_mb": 512}) Defensive patterns
Strategy: validation
Validate before calling
def valid_memory(config: dict) -> bool:
return int(config.get("max_memory_mb", 512)) > 0 Try / catch
try:
provider.initialize(config)
except SandboxProviderConfigError as e:
if "SANDBOX_LOCAL_MAX_MEMORY_MB" in str(e):
config["max_memory_mb"] = 512
provider.initialize(config)
else:
raise Prevention
- Express memory in MB, not bytes, when building the config.
- Use a single config-builder function shared by tests so invalid values are caught in CI.
- Remember rlimits are address-space caps; pick a value headroom above the workload's peak RSS.
When it happens
Trigger: Calling initialize({'max_memory_mb': 0}) or a negative value; int() coercion of a config string '0'. Also setting it very low (e.g. 1) passes validation but causes child MemoryError at runtime — though that is a separate failure.
Common situations: Trying to express 'unlimited memory' with 0; copying a container memory limit of 0 from an orchestration manifest; unit confusion (passing bytes like 536870912 instead of MB, which silently passes but is absurd).
Related errors
- SANDBOX_LOCAL_TIMEOUT must be greater than 0.
- SANDBOX_LOCAL_MAX_OUTPUT_BYTES must be greater than 0.
- SANDBOX_LOCAL_MAX_ARTIFACTS must be greater than or equal to
- SANDBOX_LOCAL_MAX_ARTIFACT_BYTES must be greater than 0.
- Invalid SSH provider configuration.
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/e67dc2fdcaa72dbc.
Report an issue: GitHub.