{"record":{"id":"3545376c12f6f4b4","repo":"microsoft/autogen","slug":"failed-to-fetch-galleries","errorCode":null,"errorMessage":"Failed to fetch galleries","messagePattern":"Failed to fetch galleries","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-studio/frontend/src/components/views/gallery/api.ts","lineNumber":14,"sourceCode":"import { Gallery } from \"../../types/datamodel\";\nimport { BaseAPI } from \"../../utils/baseapi\";\n\nexport class GalleryAPI extends BaseAPI {\n  async listGalleries(userId: string): Promise<Gallery[]> {\n    const response = await fetch(\n      `${this.getBaseUrl()}/gallery/?user_id=${userId}`,\n      {\n        headers: this.getHeaders(),\n      }\n    );\n    const data = await response.json();\n    if (!data.status)\n      throw new Error(data.message || \"Failed to fetch galleries\");\n    return data.data;\n  }\n\n  async getGallery(galleryId: number, userId: string): Promise<Gallery> {\n    const response = await fetch(\n      `${this.getBaseUrl()}/gallery/${galleryId}?user_id=${userId}`,\n      {\n        headers: this.getHeaders(),\n      }\n    );\n    const data = await response.json();\n    if (!data.status)\n      throw new Error(data.message || \"Failed to fetch gallery\");\n    return data.data;\n  }\n\n  async createGallery(\n    galleryData: Partial<Gallery>,","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-studio/frontend/src/components/views/gallery/api.ts#L1-L32","documentation":"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.","triggerScenarios":"Configuring embedding_provider='openai' with vector_fields and running a search in an environment where `from openai import AsyncOpenAI` fails.","commonSituations":"Minimal installs of autogen-ext without the openai extra; virtualenvs where openai was uninstalled as 'unused'; deployment images trimmed for size.","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."],"exampleFix":"# before: ImportError at query time\n# config.embedding_provider = \"openai\"\n\n# after\n# shell:\n#   uv add openai","handlingStrategy":"validation","validationCode":"def openai_dep_available() -> bool:\n    try:\n        from openai import AsyncOpenAI  # noqa: F401\n        return True\n    except ImportError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    results = await tool.run(query)\nexcept ImportError as e:\n    if \"uv add openai\" in str(e):\n        raise SystemExit(\"Install the openai package to use client-side embeddings\") from e\n    raise","preventionTips":["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."],"tags":["python","dependencies","openai","embeddings"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}