{"record":{"id":"6dd68b3314f8a993","repo":"continuedev/continue","slug":"http-error-status-response-status","errorCode":null,"errorMessage":"HTTP error! status: ${response.status}","messagePattern":"HTTP error! status: (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/context/providers/GreptileContextProvider.ts","lineNumber":84,"sourceCode":"            repository: repoName,\n          },\n        ],\n        sessionId: extras.config.userToken || \"default-session\",\n        stream: false,\n        genius: true,\n      }),\n    };\n\n    try {\n      const response = await extras.fetch(\n        \"https://api.greptile.com/v2/query\",\n        options,\n      );\n      const rawText = await response.text();\n\n      // Check for HTTP errors\n      if (!response.ok) {\n        throw new Error(`HTTP error! status: ${response.status}`);\n      }\n\n      // Parse the response as JSON\n      try {\n        const json = JSON.parse(rawText);\n        return json.sources.map((source: any) => ({\n          description: source.filepath,\n          content: `File: ${source.filepath}\\nLines: ${source.linestart}-${source.lineend}\\n\\n${source.summary}`,\n          name:\n            (source.filepath.split(\"/\").pop() ?? \"\").split(\"\\\\\").pop() ?? \"\",\n        }));\n      } catch (jsonError) {\n        throw new Error(`Failed to parse Greptile response:\\n${rawText}`);\n      }\n    } catch (error) {\n      console.error(\"Error getting context items from Greptile:\", error);\n      throw new Error(\"Error getting context items from Greptile\");\n    }","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/context/providers/GreptileContextProvider.ts#L66-L102","documentation":"The POST to the Greptile search API returned a non-OK HTTP status. This is the generic !response.ok guard; response.status (401, 403, 422, 500, 504...) identifies the cause. Note this throw is then swallowed by the outer catch which rethrows the generic message (see error 28).","triggerScenarios":"Calling Greptile with an invalid/expired token (401), a repo Greptile hasn't indexed or no access to (403/404), malformed query (400/422), or Greptile server issues (5xx).","commonSituations":"Expired GREPTILE_AUTH_TOKEN, repo not synced to Greptile dashboard, rate limits, or Greptile API changes/outage.","solutions":["Reproduce with curl to api.greptile.com and read the status/body","Regenerate the Greptile token if 401/403 and confirm the repo is indexed in the Greptile dashboard","Retry after a delay on 429/5xx; check Greptile status page"],"exampleFix":"// before\nif (!response.ok) {\n  throw new Error(`HTTP error! status: ${response.status}`);\n}\n// after\nif (!response.ok) {\n  const body = await response.text();\n  throw new Error(`Greptile HTTP ${response.status}: ${body.slice(0, 200)}`);\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const r = await fetch(url, options);\n  if (!r.ok && (r.status === 429 || r.status >= 500)) await retryAfterBackoff();\n} catch (e) { /* surface status from console log */ }","preventionTips":["Keep the Greptile token fresh and the repo indexed","Retry 429/5xx with exponential backoff","Log response bodies to diagnose 4xx quickly"],"tags":["greptile","http","api"],"backgroundTag":"http-api-error-response","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}