{"record":{"id":"aec356431a0e1a3c","repo":"bytedance/deer-flow","slug":"artifact-is-too-large-to-edit","errorCode":null,"errorMessage":"Artifact is too large to edit","messagePattern":"Artifact is too large to edit","errorType":"http","errorClass":"HTTPException","httpStatus":413,"severity":"warning","filePath":"backend/app/gateway/routers/artifacts.py","lineNumber":87,"sourceCode":"    stripped = path.lstrip(\"/\")\n    if not stripped.startswith(_EDITABLE_OUTPUTS_PREFIX):\n        raise HTTPException(status_code=400, detail=\"Only files in /mnt/user-data/outputs can be edited\")\n    if \".skill/\" in stripped or stripped.endswith(\".skill\"):\n        raise HTTPException(status_code=415, detail=\"Skill archives cannot be edited in the artifacts panel\")\n    return f\"/{stripped}\"\n\n\ndef _load_editable_artifact(actual_path: Path, path: str, expected_sha256: str) -> tuple[bytes, os.stat_result]:\n    try:\n        file_stat = os.lstat(actual_path)\n    except FileNotFoundError:\n        raise HTTPException(status_code=404, detail=f\"Artifact not found: {path}\") from None\n    if stat.S_ISLNK(file_stat.st_mode):\n        raise HTTPException(status_code=415, detail=\"Symlinked artifacts cannot be edited\")\n    if not stat.S_ISREG(file_stat.st_mode):\n        raise HTTPException(status_code=400, detail=f\"Path is not a file: {path}\")\n    if file_stat.st_size > MAX_EDITABLE_ARTIFACT_BYTES:\n        raise HTTPException(status_code=413, detail=\"Artifact is too large to edit\")\n\n    current = actual_path.read_bytes()\n    if len(current) > MAX_EDITABLE_ARTIFACT_BYTES:\n        raise HTTPException(status_code=413, detail=\"Artifact is too large to edit\")\n    if b\"\\x00\" in current:\n        raise HTTPException(status_code=415, detail=\"Binary artifacts cannot be edited\")\n    try:\n        current.decode(\"utf-8\")\n    except UnicodeDecodeError:\n        raise HTTPException(status_code=415, detail=\"Only UTF-8 text artifacts can be edited\") from None\n\n    current_sha256 = hashlib.sha256(current).hexdigest()\n    if current_sha256 != expected_sha256:\n        raise HTTPException(status_code=412, detail=\"Artifact changed since it was opened\")\n    return current, file_stat\n\n\ndef _encode_artifact_update(content: str) -> bytes:","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/app/gateway/routers/artifacts.py#L69-L105","documentation":"HTTP 413 from _load_editable_artifact: the lstat size of the existing artifact exceeds MAX_EDITABLE_ARTIFACT_BYTES (2 MiB, artifacts.py:40) before any bytes are read. This is the cheap pre-read guard so oversized files never enter the read/decode/hash pipeline.","triggerScenarios":"PUT edit-artifact (or open-for-edit) on any outputs file whose on-disk size is >2 MiB — large generated reports, data dumps, or logs written by the sandbox.","commonSituations":"Agents producing multi-megabyte markdown/CSV outputs, users expecting the panel editor to behave like a heavyweight text editor, version changes that raised output sizes without raising the cap.","solutions":["Open the file outside the artifact editor (download it via GET with download=true and edit locally)","Split or trim the artifact so it is under 2 MiB, or have the agent write a summary file alongside the big one","If you operate the backend and genuinely need bigger edits, raise MAX_EDITABLE_ARTIFACT_BYTES with awareness of memory cost — but prefer the first two options"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"MAX_EDITABLE_ARTIFACT_BYTES = 2 * 1024 * 1024\n\ndef is_within_edit_cap(path: str) -> bool:\n    import os\n    try:\n        return os.path.getsize(path) <= MAX_EDITABLE_ARTIFACT_BYTES\n    except OSError:\n        return False","typeGuard":null,"tryCatchPattern":"if resp.status_code == 413:\n    # offer download-and-edit-locally instead of in-panel editing\n    offer_download(path)","preventionTips":["Check size client-side before enabling in-panel editing; the cap is 2 MiB","Design agent outputs so human-edited artifacts stay small; put bulk data in separate files","Never retry the same PUT hoping the cap moves — it is a hard constant"],"tags":["api","artifacts","size-limit","http-413","limits"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}