{"record":{"id":"8ab94798dd349f6b","repo":"infiniflow/ragflow","slug":"sandbox-local-max-artifact-bytes-must-be-greater-t","errorCode":null,"errorMessage":"SANDBOX_LOCAL_MAX_ARTIFACT_BYTES must be greater than 0.","messagePattern":"SANDBOX_LOCAL_MAX_ARTIFACT_BYTES must be greater than 0\\.","errorType":"exception","errorClass":"SandboxProviderConfigError","httpStatus":null,"severity":"error","filePath":"agent/sandbox/providers/local.py","lineNumber":268,"sourceCode":"                \"default\": 10485760,\n                \"label\": \"Max Artifact Size (bytes)\",\n                \"description\": \"Maximum size of a single artifact file. Unit: bytes.\",\n                \"min\": 1024,\n                \"max\": 104857600,\n            },\n        }\n\n    def _validate_limits(self) -> None:\n        if self.timeout <= 0:\n            raise SandboxProviderConfigError(\"SANDBOX_LOCAL_TIMEOUT must be greater than 0.\")\n        if self.max_memory_mb <= 0:\n            raise SandboxProviderConfigError(\"SANDBOX_LOCAL_MAX_MEMORY_MB must be greater than 0.\")\n        if self.max_output_bytes <= 0:\n            raise SandboxProviderConfigError(\"SANDBOX_LOCAL_MAX_OUTPUT_BYTES must be greater than 0.\")\n        if self.max_artifacts < 0:\n            raise SandboxProviderConfigError(\"SANDBOX_LOCAL_MAX_ARTIFACTS must be greater than or equal to 0.\")\n        if self.max_artifact_bytes <= 0:\n            raise SandboxProviderConfigError(\"SANDBOX_LOCAL_MAX_ARTIFACT_BYTES must be greater than 0.\")\n\n    def _prepare_script(self, instance_dir: Path, language: str, code: str, args_json: str) -> tuple[list[str], Path]:\n        if language == \"python\":\n            script_path = instance_dir / \"main.py\"\n            script_path.write_text(build_python_wrapper(code, args_json), encoding=\"utf-8\")\n            return [self.python_bin, str(script_path)], script_path\n        if language in {\"javascript\", \"nodejs\"}:\n            script_path = instance_dir / \"main.js\"\n            script_path.write_text(build_javascript_wrapper(code, args_json), encoding=\"utf-8\")\n            return [self.node_bin, str(script_path)], script_path\n        raise RuntimeError(f\"Unsupported language for local provider: {language}\")\n\n    def _build_child_env(self, instance_dir: Path) -> dict[str, str]:\n        env = {\n            \"HOME\": str(instance_dir),\n            \"MPLBACKEND\": \"Agg\",\n            \"PATH\": os.environ.get(\"PATH\", \"\"),\n            \"PYTHONUNBUFFERED\": \"1\",","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/sandbox/providers/local.py#L250-L286","documentation":"Raised by LocalProvider._validate_limits() during initialize() when 'max_artifact_bytes' is zero or negative. This caps the size of any single file collected from the instance's artifacts directory (checked in _collect_artifacts via path.stat().st_size); a non-positive cap is rejected at configuration time with SandboxProviderConfigError. Default is 10 MiB (10485760).","triggerScenarios":"Calling initialize({'max_artifact_bytes': 0}) or a negative value. At runtime a run fails with a different error ('Artifact exceeds ... bytes') if a collected file is larger than this cap.","commonSituations":"Using 0 to mean 'no size limit'; passing the value in KB or bytes instead of the expected byte count and hitting an accidental zero; lowering limits globally without realizing artifacts (charts, PDFs, CSVs) routinely exceed small caps.","solutions":["Set 'max_artifact_bytes' to a positive byte count (e.g. 10485760, the default; schema min 1024, max 104857600).","Omit the key to accept the 10 MiB default.","If generated code produces large files, either raise the cap or have the code write smaller, chunked outputs.","Verify the env/config variable feeding this key is not rendering 0."],"exampleFix":"// before\nprovider.initialize({\"max_artifact_bytes\": 0})\n\n// after\nprovider.initialize({\"max_artifact_bytes\": 10485760})","handlingStrategy":"validation","validationCode":"def valid_artifact_size(config: dict) -> bool:\n    return int(config.get(\"max_artifact_bytes\", 10485760)) > 0","typeGuard":null,"tryCatchPattern":"try:\n    provider.initialize(config)\nexcept SandboxProviderConfigError as e:\n    if \"SANDBOX_LOCAL_MAX_ARTIFACT_BYTES\" in str(e):\n        config[\"max_artifact_bytes\"] = 10485760\n        provider.initialize(config)\n    else:\n        raise","preventionTips":["Size the cap for your largest expected artifact (charts, CSV exports) plus margin.","Keep the value within the schema range 1024–104857600."],"tags":["sandbox","configuration","local-provider","artifacts","validation"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}