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
- Check the Continue backend console for the 'Error getting context items from Greptile:' log line with the real cause
- Fix the underlying issue (network, token, repo indexing) per that log
- 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
- Check backend console logs whenever this generic message appears
- Treat Greptile as an optional context source with a fallback pipeline
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
- Greptile token not found.
- Failed to determine the workspace directory.
- Unable to determine remote type.
- HTTP error! status: ${response.status}
- Failed to parse Greptile response: ${rawText}
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/1236fd55909a7fc3.
Report an issue: GitHub.