CoplayDev/unity-mcp · error · Exception

Sketchfab {phase} failed (status={res?.Status}): {detail}

Error message

Sketchfab {phase} failed (status={res?.Status}): {detail}

What it means

Thrown by SketchfabAdapter.ParseOk (used by ResolveDownloadUrlAsync) when res.Ok is false. Detail is extracted from the JSON 'detail' then 'error' field, falling back to truncated raw text, scrubbed of the key. This covers HTTP failures on the Sketchfab download endpoint specifically.

Source

Thrown at MCPForUnity/Editor/Services/AssetGen/Providers/SketchfabAdapter.cs:91

                throw new Exception(SecretRedactor.Scrub($"Sketchfab {phase} failed (status={res?.Status}): {ProviderHttp.Truncate(text)}", apiKey));
            return text ?? string.Empty;
        }

        private static JObject ParseOk(HttpResult res, string apiKey, string phase)
        {
            string text = ProviderHttp.BodyText(res);

            JObject json = null;
            if (!string.IsNullOrEmpty(text))
            {
                try { json = JObject.Parse(text); } catch { /* non-JSON */ }
            }

            bool ok = res?.Ok == true;
            if (!ok)
            {
                string detail = json?["detail"]?.ToString() ?? json?["error"]?.ToString() ?? ProviderHttp.Truncate(text);
                throw new Exception(SecretRedactor.Scrub($"Sketchfab {phase} failed (status={res?.Status}): {detail}", apiKey));
            }
            return json ?? new JObject();
        }
    }
}

View on GitHub (pinned to c21bf496bc)

Solutions

  1. Read the detail field — 'detail' often carries Sketchfab's license/permission reason.
  2. 401/403 -> verify token and download permissions.
  3. 404 -> re-resolve the uid from a fresh downloadable search.
  4. 429/5xx -> back off and retry.
Defensive patterns

Strategy: retry

Try / catch

try { return await sketchfab.ResolveDownloadUrlAsync(uid, key, http, ct); }
catch (Exception ex)
{
    bool transient = ex.Message.Contains("status=429") || ex.Message.Contains("status=5");
    if (transient) await BackoffRetryAsync(() => sketchfab.ResolveDownloadUrlAsync(uid, key, http, ct), ct);
    else { /* check token download rights / uid validity */ }
}

Prevention

When it happens

Trigger: 401 token invalid; 402/403 download denied by license/permission; 404 uid not found; 429 rate limit; 5xx outage.

Common situations: Token lacks download entitlements; model license forbids download; uid stale; rate-limited after many downloads.

Related errors


AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13). Data as JSON: /api/errors/62100d1276c1b524. Report an issue: GitHub.