microsoft/autogen · error · Error
Failed to delete gallery
Error message
Failed to delete gallery
What it means
Raised by the credential normalizer (_format_credential) when a dict credential is passed but has no 'api_key' key. Dict is the convenience form for key auth — {'api_key': '<value>'} — and any other shape (e.g. {'key': ...}, {'apiKey': ...}) is rejected.
Source
Thrown at python/packages/autogen-studio/frontend/src/components/views/gallery/api.ts:87
}
);
const data = await response.json();
if (!data.status)
throw new Error(data.message || "Failed to update gallery");
return data.data;
}
async deleteGallery(galleryId: number, userId: string): Promise<void> {
const response = await fetch(
`${this.getBaseUrl()}/gallery/${galleryId}?user_id=${userId}`,
{
method: "DELETE",
headers: this.getHeaders(),
}
);
const data = await response.json();
if (!data.status)
throw new Error(data.message || "Failed to delete gallery");
}
async syncGallery(url: string): Promise<Gallery> {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Failed to sync gallery from ${url}`);
}
return await response.json();
}
}
export const galleryAPI = new GalleryAPI();
View on GitHub (pinned to 027ecf0a37)
Solutions
- Rename the dict key to 'api_key': credential={"api_key": os.environ['AZURE_SEARCH_ADMIN_KEY']}.
- Or construct a real credential object: AzureKeyCredential(value) / an AsyncTokenCredential implementation and pass that instead of a dict.
Example fix
# before
config = AzureAISearchConfig(endpoint=E, index_name=I, credential={"apiKey": KEY})
# after
config = AzureAISearchConfig(endpoint=E, index_name=I, credential={"api_key": KEY}) Defensive patterns
Strategy: type-guard
Validate before calling
def is_valid_credential_dict(cred) -> bool:
return isinstance(cred, dict) and "api_key" in cred and bool(cred["api_key"]) Type guard
from typing import Any
def is_search_credential(cred: Any) -> bool:
if isinstance(cred, dict):
return "api_key" in cred
from azure.core.credentials import AzureKeyCredential
from azure.core.credentials_async import AsyncTokenCredential
return isinstance(cred, (AzureKeyCredential, AsyncTokenCredential)) Try / catch
try:
tool = AzureAISearchTool(name="search", config=config)
except ValueError as e:
if "api_key" in str(e):
config.credential = {"api_key": os.environ["AZURE_SEARCH_ADMIN_KEY"]}
tool = AzureAISearchTool(name="search", config=config)
else:
raise Prevention
- Standardize on the {'api_key': ...} dict shape across your codebase.
- Load credentials from one helper that always returns the canonical form.
When it happens
Trigger: Passing credential={'key': '...'} or {'apiKey': '...'} or an unrelated dict (e.g. a loaded JSON settings blob) to the AzureAISearchTool constructor or config.
Common situations: Loading credentials from env/settings files whose key naming differs (apiKey vs api_key); passing the entire secrets dict instead of the single entry; assuming arbitrary keys are forwarded to the SDK.
Related errors
- Failed to get login URL
- Authentication failed
- Failed to sync gallery from ${url}
- Invalid server URL configuration
- Template ${templateId} not found for component type ${compon
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/f920da8a883b1c4f.
Report an issue: GitHub.