microsoft/autogen · error · Error
Failed to fetch galleries
Error message
Failed to fetch galleries
What it means
Raised when `embedding_provider="openai"` is configured but the `openai` package is not installed. Like the Azure path, the import of AsyncOpenAI happens lazily at first embedding call, so the tool imports fine but fails at query time without the dependency.
Source
Thrown at python/packages/autogen-studio/frontend/src/components/views/gallery/api.ts:14
import { Gallery } from "../../types/datamodel";
import { BaseAPI } from "../../utils/baseapi";
export class GalleryAPI extends BaseAPI {
async listGalleries(userId: string): Promise<Gallery[]> {
const response = await fetch(
`${this.getBaseUrl()}/gallery/?user_id=${userId}`,
{
headers: this.getHeaders(),
}
);
const data = await response.json();
if (!data.status)
throw new Error(data.message || "Failed to fetch galleries");
return data.data;
}
async getGallery(galleryId: number, userId: string): Promise<Gallery> {
const response = await fetch(
`${this.getBaseUrl()}/gallery/${galleryId}?user_id=${userId}`,
{
headers: this.getHeaders(),
}
);
const data = await response.json();
if (!data.status)
throw new Error(data.message || "Failed to fetch gallery");
return data.data;
}
async createGallery(
galleryData: Partial<Gallery>,View on GitHub (pinned to 027ecf0a37)
Solutions
- Install it: `uv add openai` (or `pip install openai`) into the executing environment.
- Smoke-test the import in the deploy pipeline: `python -c "import openai"`.
- Or remove client-side embeddings (drop vector_fields / embedding_provider) if not needed.
Example fix
# before: ImportError at query time # config.embedding_provider = "openai" # after # shell: # uv add openai
Defensive patterns
Strategy: validation
Validate before calling
def openai_dep_available() -> bool:
try:
from openai import AsyncOpenAI # noqa: F401
return True
except ImportError:
return False Try / catch
try:
results = await tool.run(query)
except ImportError as e:
if "uv add openai" in str(e):
raise SystemExit("Install the openai package to use client-side embeddings") from e
raise Prevention
- Include openai in your dependency set whenever embedding_provider='openai' is possible.
- Smoke-test imports in the runtime image, not just on your dev machine.
When it happens
Trigger: Configuring embedding_provider='openai' with vector_fields and running a search in an environment where `from openai import AsyncOpenAI` fails.
Common situations: Minimal installs of autogen-ext without the openai extra; virtualenvs where openai was uninstalled as 'unused'; deployment images trimmed for size.
Related errors
- Unauthorized
- Failed to fetch gallery
- Authentication failed
- Template ${templateId} not found for component type ${compon
- Workbench template ${templateId} not found
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/3545376c12f6f4b4.
Report an issue: GitHub.