Significant-Gravitas/AutoGPT · error · HTTPException

Failed to upload logo

Error message

Failed to upload logo

What it means

Returned (500) when the async GCS upload (async_storage client.upload to the media bucket) raises. Any storage-layer failure — missing bucket, permission denied on the service account, network/DNS errors, or misconfigured credentials — is caught and surfaced as this generic message; details are only in server logs.

Source

Thrown at autogpt_platform/backend/backend/api/features/oauth.py:787

    # Generate unique filename
    file_ext = os.path.splitext(filename)[1].lower() or ".png"
    unique_filename = f"{uuid.uuid4()}{file_ext}"
    storage_path = f"oauth-apps/{app_id}/logo/{unique_filename}"

    # Upload to GCS
    try:
        async with async_storage.Storage() as async_client:
            bucket_name = settings.config.media_gcs_bucket_name

            await async_client.upload(
                bucket_name, storage_path, file_bytes, content_type=content_type
            )

            logo_url = f"https://storage.googleapis.com/{bucket_name}/{storage_path}"
    except Exception as e:
        logger.error(f"Error uploading logo to GCS: {e}")
        raise HTTPException(
            status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
            detail="Failed to upload logo",
        )

    # Delete the current app logo file (if any and it's in our cloud storage)
    await _delete_app_current_logo_file(app)

    # Update the app with the new logo URL
    updated_app = await update_oauth_application(
        app_id=app_id,
        owner_id=user_id,
        logo_url=logo_url,
    )

    if not updated_app:
        raise HTTPException(
            status_code=status.HTTP_404_NOT_FOUND,
            detail="Application not found or you don't have permission to update it",

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Check backend logs for 'Error uploading logo to GCS' to get the underlying exception
  2. Verify the bucket exists and the backend's service account has Storage Object Admin (or objects.create) on it
  3. Test connectivity/credentials with gsutil cp from the same host
  4. Confirm the configured bucket name matches the actual GCS bucket

Example fix

# grant upload rights
# before: service account has no role on the bucket
gcloud storage buckets add-iam-policy-binding gs://my-media-bucket --member="serviceAccount:backend@project.iam.gserviceaccount.com" --role="roles/storage.objectAdmin"
Defensive patterns

Strategy: fallback

Validate before calling

from google.cloud import storage
client = storage.Client()
bucket = client.get_bucket(settings.config.media_gcs_bucket_name)  # fails fast if bucket/creds bad

Try / catch

if resp.status_code == 500 and "Failed to upload logo" in resp.text:
    alert_ops_with_server_log_context()  # not client-retryable without infra fix

Prevention

When it happens

Trigger: Bucket name set but bucket does not exist; GCS service account lacks storage.objects.create; expired credentials; outage or network egress block from the backend host.

Common situations: Bucket name typo in config; IAM roles not granted to the workload's service account; self-hosted cluster without egress to storage.googleapis.com; bucket in a different project with no access.

Related errors


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