{"record":{"id":"4652c8e1cd3fee43","repo":"decolua/9router","slug":"http-result-response-status","errorCode":null,"errorMessage":"HTTP ${result.response.status}","messagePattern":"HTTP \\$\\{result\\.response\\.status\\}","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"open-sse/handlers/imageProviders/antigravity.js","lineNumber":69,"sourceCode":"      const inlineData = resolveImageInput(imageInput);\n      if (inlineData) parts.unshift(inlineData);\n    }\n\n    const chatBody = {\n      contents: [{ role: \"user\", parts }],\n    };\n\n    const result = await executor.execute({\n      model: targetModel,\n      body: chatBody,\n      stream: false,\n      credentials,\n      log,\n    });\n\n    if (!result.response.ok) {\n      const text = await result.response.text();\n      throw new Error(text || `HTTP ${result.response.status}`);\n    }\n\n    return result.response.json();\n  },\n\n  normalize: (responseBody, prompt) => {\n    const candidates = responseBody.candidates || responseBody.response?.candidates || [];\n    const parts = candidates[0]?.content?.parts || [];\n    const images = parts.filter((p) => p.inlineData?.data).map((p) => ({\n      b64_json: p.inlineData.data,\n    }));\n    return {\n      created: nowSec(),\n      data: images.length > 0 ? images : [{ b64_json: \"\", revised_prompt: prompt }],\n    };\n  },\n};","sourceCodeStart":51,"sourceCodeEnd":86,"githubUrl":"https://github.com/decolua/9router/blob/90b52e06ffd666b7929554211474d01588f6b1f8/open-sse/handlers/imageProviders/antigravity.js#L51-L86","documentation":"Thrown by the Antigravity image adapter's executeViaExecutor (open-sse/handlers/imageProviders/antigravity.js:69) when the upstream HTTP response from the Antigravity executor is not ok. The thrown message is the raw response body text when present, otherwise the generic 'HTTP {status}'. This is the adapter's surfacing of any upstream rejection — auth failures, quota, invalid model suffix, malformed request — so the status/body is the real diagnostic.","triggerScenarios":"executor.execute(...) returns result.response with response.ok === false: 401/403 (expired or missing Antigravity OAuth credentials), 404 (target model name like 'gemini-3.1-flash-image-1x1' not available to the account), 429 (rate limited), 4xx/5xx with an error body. The response text is read and thrown directly.","commonSituations":"Antigravity credentials expired and need re-auth; the aspect-ratio-suffixed image model doesn't exist for the account/region; request body rejected due to an oversized or malformed inlineData image; upstream outage returning 5xx with an HTML body (thrown verbatim as the error message).","solutions":["Read the thrown message (it contains the upstream body): fix the specific cause — re-authenticate for 401/403, back off for 429.","For 404/model errors, check the resolved target model (model with aspect-ratio suffix appended) is valid for your account; adjust the requested size or model.","If the input image is large, shrink it before sending (inlineData base64 has size limits).","Check Antigravity service status if you see bare 'HTTP 5xx' with an empty body."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before generation, confirm the resolved model exists\nconst targetModel = /image|imagen/i.test(model) ? model : \"gemini-3.1-flash-image\";\nif (!supportedAntigravityModels.includes(targetModel)) {\n  throw new Error(`Model ${targetModel} unavailable for this account`);\n}","typeGuard":"function isUpstreamHttpError(e) {\n  return e instanceof Error && (/^HTTP \\d{3}$/.test(e.message) || /^\\s*\\{/.test(e.message));\n}","tryCatchPattern":"try {\n  const image = await generateImage({ provider: \"antigravity\", ... });\n} catch (e) {\n  if (/HTTP 40[13]/.test(e.message)) return reauthAndRetry();\n  if (/HTTP 429/.test(e.message)) return backoffRetry(3);\n  // otherwise the message contains the upstream body — log it verbatim for diagnosis\n  log.error(\"antigravity upstream:\", e.message);\n  throw e;\n}","preventionTips":["Keep Antigravity OAuth credentials refreshed before they expire.","Validate requested sizes map to real aspect-ratio model variants for your account.","Cap inline image sizes before base64-encoding them into the request.","Log full response bodies on failure — the thrown message is the upstream error."],"tags":["http","upstream-error","image-generation","antigravity","api-response"],"backgroundTag":"upstream-http-error","analyzedSha":"90b52e06ffd666b7929554211474d01588f6b1f8","analyzedAt":"2026-08-30T21:05:45.952Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}