{"record":{"id":"8f936eddbe6795a6","repo":"linshenkx/prompt-optimizer","slug":"garden-suggestions-request-failed-resp-status","errorCode":null,"errorMessage":"Garden suggestions request failed: ${resp.status}","messagePattern":"Garden suggestions request failed: (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ui/src/utils/prompt-garden-suggestions.ts","lineNumber":165,"sourceCode":"  const url = buildPromptGardenSuggestionsUrl({\n    ...options,\n    gardenBaseUrl,\n  })\n\n  const controller = new AbortController()\n  const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? DEFAULT_TIMEOUT_MS)\n\n  try {\n    const resp = await fetch(url, {\n      method: 'GET',\n      headers: {\n        Accept: 'application/json',\n      },\n      signal: controller.signal,\n    })\n\n    if (!resp.ok) {\n      throw new Error(`Garden suggestions request failed: ${resp.status}`)\n    }\n\n    const data = (await resp.json()) as unknown\n    if (!isRecord(data)) {\n      throw new Error('Garden suggestions response must be an object')\n    }\n\n    const items = Array.isArray(data.items)\n      ? data.items\n          .map((item) => normalizeSuggestionItem(item, gardenBaseUrl))\n          .filter((item): item is PromptGardenSuggestionItem => Boolean(item))\n      : []\n\n    const browseUrl =\n      resolveGardenUrl(gardenBaseUrl, data.browseUrl) ||\n      buildFallbackBrowseUrl(gardenBaseUrl, options.mode)\n\n    const ttlSeconds =","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/ui/src/utils/prompt-garden-suggestions.ts#L147-L183","documentation":"Thrown by fetchPromptGardenSuggestions when the HTTP request to the Prompt Garden suggestions endpoint completes with a non-ok status. The response status code is embedded in the message so the caller can distinguish auth failures, not-found, and server errors.","triggerScenarios":"GET {gardenBaseUrl}/api/public/prompts/suggestions returning 401/403 (invalid or missing API auth), 404 (wrong base URL or path, service version mismatch), 429 (rate limited), or 5xx (garden service down).","commonSituations":"Base URL pointing to an environment that does not host the public suggestions route; expired or missing API credentials; garden service deploy removed/renamed the endpoint; hitting rate limits from a shared key.","solutions":["Check the embedded status: 401/403 means fix credentials, 404 means fix base URL/route, 5xx means retry later or check service health","Confirm the base URL includes the right environment and that /api/public/prompts/suggestions exists there (open it in a browser/curl)","Add retry with backoff for transient 5xx/429 responses","Verify query params (mode, limit, strategy) are supported by the deployed garden version"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"const MAX = 3\nfor (let i = 0; i < MAX; i++) {\n  try {\n    return await fetchPromptGardenSuggestions(options)\n  } catch (error) {\n    const status = Number(/(\\d{3})\\s*$/.exec((error as Error).message)?.[1])\n    const retryable = status >= 500 || status === 429\n    if (!retryable || i === MAX - 1) throw error\n    await new Promise((r) => setTimeout(r, 2 ** i * 500))\n  }\n}","preventionTips":["Extract and switch on the embedded status code before retrying","Only retry 429/5xx; surface 4xx as config bugs immediately","Cache last successful suggestions to serve on failure"],"tags":["http-status","prompt-garden","api-request","network"],"backgroundTag":"api-request-failed","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}