Significant-Gravitas/AutoGPT · error · MissingConfigError

GCS media bucket is not configured

Error message

GCS media bucket is not configured

What it means

MissingConfigError raised by store_media.check_media_exists() (and the same guard pattern in the rest of media.py) when Settings().config.media_gcs_bucket_name is empty. All media lookups/uploads construct GCS paths from this bucket name, so the module refuses to operate rather than silently reading/writing a bogus bucket.

Source

Thrown at autogpt_platform/backend/backend/api/features/store/media.py:35

ALLOWED_VIDEO_TYPES = {"video/mp4", "video/webm"}
MAX_FILE_SIZE = 50 * 1024 * 1024  # 50MB


async def check_media_exists(user_id: str, filename: str) -> str | None:
    """
    Check if a media file exists in storage for the given user.
    Tries both images and videos directories.

    Args:
        user_id (str): ID of the user who uploaded the file
        filename (str): Name of the file to check

    Returns:
        str | None: URL of the blob if it exists, None otherwise
    """
    settings = Settings()
    if not settings.config.media_gcs_bucket_name:
        raise MissingConfigError("GCS media bucket is not configured")

    async with async_storage.Storage() as async_client:
        bucket_name = settings.config.media_gcs_bucket_name

        # Check images
        image_path = f"users/{user_id}/images/{filename}"
        try:
            await async_client.download_metadata(bucket_name, image_path)
            # If we get here, the file exists - construct public URL
            return f"https://storage.googleapis.com/{bucket_name}/{image_path}"
        except Exception:
            # File doesn't exist, continue to check videos
            pass

        # Check videos
        video_path = f"users/{user_id}/videos/{filename}"
        try:
            await async_client.download_metadata(bucket_name, video_path)

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Set MEDIA_GCS_BUCKET_NAME (per backend/.env.default naming) to an existing GCS bucket and restart the backend.
  2. Ensure the bucket exists and the service account/credentials the backend uses has read (and write, for uploads) access to it.
  3. For environments that intentionally skip media, avoid calling media endpoints or feature-flag the UI paths that hit them.

Example fix

// before
# backend/.env
# MEDIA_GCS_BUCKET_NAME=

// after
MEDIA_GCS_BUCKET_NAME=agpt-media-prod
Defensive patterns

Strategy: validation

Validate before calling

from backend.util.settings import Settings

def media_configured() -> bool:
    return bool(Settings().config.media_gcs_bucket_name)

Try / catch

from backend.util.exceptions import MissingConfigError

try:
    url = await store_media.check_media_exists(user_id, filename)
except MissingConfigError:
    raise HTTPException(503, "Media storage is not configured")

Prevention

When it happens

Trigger: Any store media endpoint (check media existence, upload agent image, serve media) on a deployment where MEDIA_GCS_BUCKET_NAME is not set — fresh local dev, new staging environment, or the GCS media feature not provisioned.

Common situations: .env copied from .env.default which leaves the bucket blank for local runs; production secret not migrated during infra move; bucket renamed without updating config.

Related errors


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