linshenkx/prompt-optimizer · error · Error

Garden suggestions request failed: ${resp.status}

Error message

Garden suggestions request failed: ${resp.status}

What it means

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.

Source

Thrown at packages/ui/src/utils/prompt-garden-suggestions.ts:165

  const url = buildPromptGardenSuggestionsUrl({
    ...options,
    gardenBaseUrl,
  })

  const controller = new AbortController()
  const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? DEFAULT_TIMEOUT_MS)

  try {
    const resp = await fetch(url, {
      method: 'GET',
      headers: {
        Accept: 'application/json',
      },
      signal: controller.signal,
    })

    if (!resp.ok) {
      throw new Error(`Garden suggestions request failed: ${resp.status}`)
    }

    const data = (await resp.json()) as unknown
    if (!isRecord(data)) {
      throw new Error('Garden suggestions response must be an object')
    }

    const items = Array.isArray(data.items)
      ? data.items
          .map((item) => normalizeSuggestionItem(item, gardenBaseUrl))
          .filter((item): item is PromptGardenSuggestionItem => Boolean(item))
      : []

    const browseUrl =
      resolveGardenUrl(gardenBaseUrl, data.browseUrl) ||
      buildFallbackBrowseUrl(gardenBaseUrl, options.mode)

    const ttlSeconds =

View on GitHub (pinned to 3e677b1d9f)

Solutions

  1. Check the embedded status: 401/403 means fix credentials, 404 means fix base URL/route, 5xx means retry later or check service health
  2. Confirm the base URL includes the right environment and that /api/public/prompts/suggestions exists there (open it in a browser/curl)
  3. Add retry with backoff for transient 5xx/429 responses
  4. Verify query params (mode, limit, strategy) are supported by the deployed garden version
Defensive patterns

Strategy: retry

Try / catch

const MAX = 3
for (let i = 0; i < MAX; i++) {
  try {
    return await fetchPromptGardenSuggestions(options)
  } catch (error) {
    const status = Number(/(\d{3})\s*$/.exec((error as Error).message)?.[1])
    const retryable = status >= 500 || status === 429
    if (!retryable || i === MAX - 1) throw error
    await new Promise((r) => setTimeout(r, 2 ** i * 500))
  }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27). Data as JSON: /api/errors/8f936eddbe6795a6. Report an issue: GitHub.