Significant-Gravitas/AutoGPT · error · ValueError

reviewed_data is too large (max 1MB)

Error message

reviewed_data is too large (max 1MB)

What it means

ValueError raised inside the same field_validator when json.dumps(reviewed_data) exceeds 1,000,000 characters (~1MB). It is an explicit DoS guard: oversized review payloads are rejected at the API boundary before storage. Pydantic reports it as a 422.

Source

Thrown at autogpt_platform/backend/backend/api/features/executions/review/model.py:173

                return True
            elif isinstance(obj, dict):
                return all(
                    isinstance(k, str) and validate_safejson_type(v)
                    for k, v in obj.items()
                )
            elif isinstance(obj, list):
                return all(validate_safejson_type(item) for item in obj)
            else:
                return False

        if not validate_safejson_type(v):
            raise ValueError("reviewed_data contains non-SafeJson compatible types")

        # Validate data size to prevent DoS attacks
        try:
            json_str = json.dumps(v)
            if len(json_str) > 1000000:  # 1MB limit
                raise ValueError("reviewed_data is too large (max 1MB)")
        except (TypeError, ValueError) as e:
            raise ValueError(f"reviewed_data must be JSON serializable: {str(e)}")

        # Ensure no dangerous nested structures (prevent infinite recursion)
        def check_depth(obj, max_depth=10, current_depth=0):
            """Recursively check object nesting depth to prevent stack overflow attacks."""
            if current_depth > max_depth:
                raise ValueError("reviewed_data has excessive nesting depth")

            if isinstance(obj, dict):
                for value in obj.values():
                    check_depth(value, max_depth, current_depth + 1)
            elif isinstance(obj, list):
                for item in obj:
                    check_depth(item, max_depth, current_depth + 1)

        check_depth(v)
        return v

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Trim or summarize large payloads before submission (store big blobs elsewhere and pass a reference)
  2. Check len(json.dumps(data)) client-side before posting
  3. Split reviews across multiple ReviewItems if the data legitimately exceeds 1MB

Example fix

# before
reviewed_data=big_blob  # ~2MB base64
# after
reviewed_data={"blobRef": upload_blob(big_blob), "summary": summarize(big_blob)}
Defensive patterns

Strategy: validation

Validate before calling

const serialized = JSON.stringify(reviewedData);
if (serialized.length > 1_000_000) throw new Error('reviewed_data too large');

Prevention

When it happens

Trigger: Submitting reviewed_data containing a large base64 blob, a full dataset dump, or a long log array whose serialized JSON crosses the 1MB character limit.

Common situations: Users pasting huge file contents into an AI-review data field; clients echoing back entire execution outputs as reviewed_data.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/3a97139d677e2be0. Report an issue: GitHub.