bytedance/deer-flow · warning · HTTPException

Artifact is too large to edit

Error message

Artifact is too large to edit

What it means

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.

Source

Thrown at backend/app/gateway/routers/artifacts.py:87

    stripped = path.lstrip("/")
    if not stripped.startswith(_EDITABLE_OUTPUTS_PREFIX):
        raise HTTPException(status_code=400, detail="Only files in /mnt/user-data/outputs can be edited")
    if ".skill/" in stripped or stripped.endswith(".skill"):
        raise HTTPException(status_code=415, detail="Skill archives cannot be edited in the artifacts panel")
    return f"/{stripped}"


def _load_editable_artifact(actual_path: Path, path: str, expected_sha256: str) -> tuple[bytes, os.stat_result]:
    try:
        file_stat = os.lstat(actual_path)
    except FileNotFoundError:
        raise HTTPException(status_code=404, detail=f"Artifact not found: {path}") from None
    if stat.S_ISLNK(file_stat.st_mode):
        raise HTTPException(status_code=415, detail="Symlinked artifacts cannot be edited")
    if not stat.S_ISREG(file_stat.st_mode):
        raise HTTPException(status_code=400, detail=f"Path is not a file: {path}")
    if file_stat.st_size > MAX_EDITABLE_ARTIFACT_BYTES:
        raise HTTPException(status_code=413, detail="Artifact is too large to edit")

    current = actual_path.read_bytes()
    if len(current) > MAX_EDITABLE_ARTIFACT_BYTES:
        raise HTTPException(status_code=413, detail="Artifact is too large to edit")
    if b"\x00" in current:
        raise HTTPException(status_code=415, detail="Binary artifacts cannot be edited")
    try:
        current.decode("utf-8")
    except UnicodeDecodeError:
        raise HTTPException(status_code=415, detail="Only UTF-8 text artifacts can be edited") from None

    current_sha256 = hashlib.sha256(current).hexdigest()
    if current_sha256 != expected_sha256:
        raise HTTPException(status_code=412, detail="Artifact changed since it was opened")
    return current, file_stat


def _encode_artifact_update(content: str) -> bytes:

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Open the file outside the artifact editor (download it via GET with download=true and edit locally)
  2. Split or trim the artifact so it is under 2 MiB, or have the agent write a summary file alongside the big one
  3. 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
Defensive patterns

Strategy: validation

Validate before calling

MAX_EDITABLE_ARTIFACT_BYTES = 2 * 1024 * 1024

def is_within_edit_cap(path: str) -> bool:
    import os
    try:
        return os.path.getsize(path) <= MAX_EDITABLE_ARTIFACT_BYTES
    except OSError:
        return False

Try / catch

if resp.status_code == 413:
    # offer download-and-edit-locally instead of in-panel editing
    offer_download(path)

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14). Data as JSON: /api/errors/aec356431a0e1a3c. Report an issue: GitHub.