{"record":{"id":"5de8681023686007","repo":"Significant-Gravitas/AutoGPT","slug":"failed-to-upload-logo","errorCode":null,"errorMessage":"Failed to upload logo","messagePattern":"Failed to upload logo","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/oauth.py","lineNumber":787,"sourceCode":"\n    # Generate unique filename\n    file_ext = os.path.splitext(filename)[1].lower() or \".png\"\n    unique_filename = f\"{uuid.uuid4()}{file_ext}\"\n    storage_path = f\"oauth-apps/{app_id}/logo/{unique_filename}\"\n\n    # Upload to GCS\n    try:\n        async with async_storage.Storage() as async_client:\n            bucket_name = settings.config.media_gcs_bucket_name\n\n            await async_client.upload(\n                bucket_name, storage_path, file_bytes, content_type=content_type\n            )\n\n            logo_url = f\"https://storage.googleapis.com/{bucket_name}/{storage_path}\"\n    except Exception as e:\n        logger.error(f\"Error uploading logo to GCS: {e}\")\n        raise HTTPException(\n            status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,\n            detail=\"Failed to upload logo\",\n        )\n\n    # Delete the current app logo file (if any and it's in our cloud storage)\n    await _delete_app_current_logo_file(app)\n\n    # Update the app with the new logo URL\n    updated_app = await update_oauth_application(\n        app_id=app_id,\n        owner_id=user_id,\n        logo_url=logo_url,\n    )\n\n    if not updated_app:\n        raise HTTPException(\n            status_code=status.HTTP_404_NOT_FOUND,\n            detail=\"Application not found or you don't have permission to update it\",","sourceCodeStart":769,"sourceCodeEnd":805,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/oauth.py#L769-L805","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check backend logs for 'Error uploading logo to GCS' to get the underlying exception","Verify the bucket exists and the backend's service account has Storage Object Admin (or objects.create) on it","Test connectivity/credentials with gsutil cp from the same host","Confirm the configured bucket name matches the actual GCS bucket"],"exampleFix":"# grant upload rights\n# before: service account has no role on the bucket\ngcloud storage buckets add-iam-policy-binding gs://my-media-bucket --member=\"serviceAccount:backend@project.iam.gserviceaccount.com\" --role=\"roles/storage.objectAdmin\"","handlingStrategy":"fallback","validationCode":"from google.cloud import storage\nclient = storage.Client()\nbucket = client.get_bucket(settings.config.media_gcs_bucket_name)  # fails fast if bucket/creds bad","typeGuard":null,"tryCatchPattern":"if resp.status_code == 500 and \"Failed to upload logo\" in resp.text:\n    alert_ops_with_server_log_context()  # not client-retryable without infra fix","preventionTips":["Add a deployment check that verifies GCS write access to the media bucket","Grant the backend service account roles/storage.objectAdmin on the bucket","Monitor for 'Error uploading logo to GCS' in backend logs"],"tags":["gcs","http-500","storage","permissions"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}