continuedev/continue · error · Error

Error getting context items from Greptile

Error message

Error getting context items from Greptile

What it means

Catch-all thrown from the outer try in getContextItems: any failure inside the Greptile flow (token checks aside), including fetch errors, HTTP errors (26), and JSON parse errors (27), is logged via console.error and rethrown with this generic message. The original error detail is lost to the caller.

Source

Thrown at core/context/providers/GreptileContextProvider.ts:101

      if (!response.ok) {
        throw new Error(`HTTP error! status: ${response.status}`);
      }

      // Parse the response as JSON
      try {
        const json = JSON.parse(rawText);
        return json.sources.map((source: any) => ({
          description: source.filepath,
          content: `File: ${source.filepath}\nLines: ${source.linestart}-${source.lineend}\n\n${source.summary}`,
          name:
            (source.filepath.split("/").pop() ?? "").split("\\").pop() ?? "",
        }));
      } catch (jsonError) {
        throw new Error(`Failed to parse Greptile response:\n${rawText}`);
      }
    } catch (error) {
      console.error("Error getting context items from Greptile:", error);
      throw new Error("Error getting context items from Greptile");
    }
  }

  private getGreptileToken(): string | undefined {
    return this.options.GreptileToken || process.env.GREPTILE_AUTH_TOKEN;
  }

  private getGithubToken(): string | undefined {
    return this.options.GithubToken || process.env.GITHUB_TOKEN;
  }

  private async getWorkspaceDir(
    extras: ContextProviderExtras,
  ): Promise<string | null> {
    try {
      const workspaceDirs = await extras.ide.getWorkspaceDirs();
      if (workspaceDirs && workspaceDirs.length > 0) {
        return workspaceDirs[0];

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Check the Continue backend console for the 'Error getting context items from Greptile:' log line with the real cause
  2. Fix the underlying issue (network, token, repo indexing) per that log
  3. Consider contributing a rethrow of error instead of a new generic Error to preserve the message

Example fix

// before
} catch (error) {
  console.error('Error getting context items from Greptile:', error);
  throw new Error('Error getting context items from Greptile');
}
// after
} catch (error) {
  console.error('Error getting context items from Greptile:', error);
  throw error instanceof Error ? error : new Error(String(error));
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const items = await greptileProvider.getContextItems(q, extras);
} catch (e) {
  if (/Error getting context items from Greptile/.test(e.message)) {
    // inspect backend logs for the root cause; degrade gracefully
    return [];
  }
  throw e;
}

Prevention

When it happens

Trigger: Any exception in the Greptile network/mapping block: network down, HTTP error status, JSON parse failure, or TypeError while mapping sources.

Common situations: Offline machine, expired token causing 401, or API response shape change — user only sees the generic message unless they check backend logs.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/1236fd55909a7fc3. Report an issue: GitHub.