CoplayDev/unity-mcp · error · Exception

fal submit returned no request_id: {truncated_response}

Error message

fal submit returned no request_id: {truncated_response}

What it means

After submitting to fal, the image adapter expects either a 'response_url' or a 'request_id' field in the JSON response. If both are missing/empty, it throws a generic Exception whose message is the truncated response text, scrubbed of the apiKey via SecretRedactor. This signals an unexpected or empty fal response.

Source

Thrown at MCPForUnity/Editor/Services/AssetGen/Providers/FalAdapter.cs:77

            var spec = new HttpRequestSpec
            {
                Method = "POST",
                Url = url,
                ContentType = "application/json",
                Body = Encoding.UTF8.GetBytes(body.ToString(Formatting.None))
            };
            spec.Headers["Authorization"] = "Key " + apiKey;

            HttpResult res = await http.SendAsync(spec, ct);
            JObject json = ParseOk(res, apiKey, "submit");

            // Prefer response_url; fall back to building it from request_id.
            string responseUrl = json["response_url"]?.ToString();
            if (string.IsNullOrEmpty(responseUrl))
            {
                string requestId = json["request_id"]?.ToString();
                if (string.IsNullOrEmpty(requestId))
                    throw new Exception(SecretRedactor.Scrub("fal submit returned no request_id: " + ProviderHttp.Truncate(res?.Text), apiKey));
                // Queue request URLs are namespaced by owner/app without the action sub-path,
                // so build from the base model id (not `url`, which may end in /edit).
                responseUrl = QueueBase + model + "/requests/" + requestId;
            }
            // The response_url is provider-controlled; refuse to later attach the key to any host
            // other than the fal queue.
            ProviderHttp.RequireHost(responseUrl, QueueHost, apiKey, "fal submit response_url");
            return responseUrl;
        }

        public async Task<ProviderPollResult> PollAsync(string providerJobId, string apiKey, IHttpTransport http, CancellationToken ct)
        {
            if (string.IsNullOrEmpty(providerJobId)) throw new ArgumentNullException(nameof(providerJobId));
            string responseUrl = providerJobId;
            // providerJobId is provider-supplied (the submit-time response_url). Re-validate before
            // attaching the key so a poisoned URL can never exfiltrate it.
            ProviderHttp.RequireHost(responseUrl, QueueHost, apiKey, "fal poll");

View on GitHub (pinned to c21bf496bc)

Solutions

  1. Inspect the truncated response text in the message (the apiKey is scrubbed) to see what fal actually returned.
  2. Verify the model id and submit endpoint are current per fal's docs.
  3. Check fal status pages for response-shape or outage notices.
  4. Confirm the API key is valid and has not been rotated or revoked.
Defensive patterns

Strategy: retry

Validate before calling

// You cannot validate provider response shape before the call, but you can guard the submit inputs.
if (string.IsNullOrEmpty(modelId)) throw new ArgumentException("modelId required");
if (string.IsNullOrEmpty(apiKey)) throw new ArgumentException("apiKey required");

Try / catch

for (int attempt = 0; attempt < 3; attempt++)
{
    try { return await fal.SubmitAsync(model, req, apiKey, http, ct); }
    catch (Exception ex) when (attempt < 2 && ex.Message.Contains("no request_id"))
    {
        await Task.Delay(500 * (attempt + 1), ct); // transient empty response; retry
    }
}

Prevention

When it happens

Trigger: fal returned an HTTP success but the body contained neither 'response_url' nor 'request_id'; the response shape changed; a redirect or HTML error page was parsed as a 2xx body.

Common situations: fal API version/shape change; wrong endpoint or model id returning an unexpected body; quota/auth edge returning an empty body; a proxy mangling the response.

Related errors


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