CoplayDev/unity-mcp · error · NotSupportedException
Unknown image provider
Error message
Unknown image provider '{id}'. What it means
AssetGenProviders.Image lowercases the provider id and switches over it, returning an adapter for known image providers ('fal', 'openrouter'). Any other id hits default and throws NotSupportedException.
Solutions
- Use a supported image provider id: 'fal' or 'openrouter'.
- Enumerate providers via AssetGenProviders.List() and filter by Kind == 'image' before selecting.
- Check spelling; the id is case-insensitive but must match exactly otherwise.
Defensive patterns
Strategy: validation
Validate before calling
var supported = AssetGenProviders.List().Where(p => p.Kind == "image").Select(p => p.Id).ToHashSet();
if (!supported.Contains(id.ToLowerInvariant()))
throw new ArgumentException($"Unknown image provider '{id}'. Supported: {string.Join(", ", supported)}");
var adapter = AssetGenProviders.Image(id); Type guard
static readonly HashSet<string> KnownImageProviders = new HashSet<string> { "fal", "openrouter" };
static bool IsKnownImageProvider(string id) => KnownImageProviders.Contains((id ?? "").ToLowerInvariant()); Try / catch
try { var adapter = AssetGenProviders.Image(id); }
catch (NotSupportedException ex) when (ex.Message.Contains("Unknown image provider"))
{
var adapter = AssetGenProviders.Image("fal");
} Prevention
- Filter AssetGenProviders.List() by Kind == 'image' to get valid ids.
- Validate AI-suggested provider names against the supported set.
- Do not assume a model provider id is also a valid image provider id.
When it happens
Trigger: Calling Image() with an id not in the switch, e.g. 'stability', 'dalle', or a typo of 'fal'/'openrouter'.
Common situations: An AI/LLM hallucinating an image provider; config referencing a provider that is not implemented for images; a caller mixing up model vs image provider ids.
Related errors
- Unknown audio provider
- Unknown marketplace provider
- Unknown model provider
- 'output_folder' must resolve under the project's Assets…
- provider returned a disallowed file type '.
AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13).
Data as JSON: /api/errors/ace9bd953c78b7a7.
Report an issue: GitHub.
Appendix: source
Thrown at MCPForUnity/Editor/Services/AssetGen/Providers/AssetGenProviders.cs:37
case "tripo":
return new TripoAdapter();
case "meshy":
return new MeshyAdapter();
default:
throw new NotSupportedException($"Unknown model provider '{id}'.");
}
}
public static IImageProviderAdapter Image(string id)
{
switch ((id ?? string.Empty).ToLowerInvariant())
{
case "fal":
return new FalAdapter();
case "openrouter":
return new OpenRouterAdapter();
default:
throw new NotSupportedException($"Unknown image provider '{id}'.");
}
}
public static IAudioProviderAdapter Audio(string id)
{
switch ((id ?? string.Empty).ToLowerInvariant())
{
case "fal":
return new FalAudioAdapter();
default:
throw new NotSupportedException($"Unknown audio provider '{id}'.");
}
}
public static IMarketplaceProviderAdapter Marketplace(string id)
{
switch ((id ?? string.Empty).ToLowerInvariant())
{View on GitHub (pinned to c21bf496bc)