continuedev/continue · error · Error

Failed to determine the workspace directory.

Error message

Failed to determine the workspace directory.

What it means

Thrown when this.getWorkspaceDir(extras) resolves to an empty/undefined path. The provider needs a local workspace directory to derive the git remote and branch for the Greptile query; with no open folder it cannot proceed.

Source

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

  }

  async getContextItems(
    query: string,
    extras: ContextProviderExtras,
  ): Promise<ContextItem[]> {
    const greptileToken = this.getGreptileToken();
    if (!greptileToken) {
      throw new Error("Greptile token not found.");
    }

    const githubToken = this.getGithubToken();
    if (!githubToken) {
      throw new Error("GitHub token not found.");
    }

    let absPath = await this.getWorkspaceDir(extras);
    if (!absPath) {
      throw new Error("Failed to determine the workspace directory.");
    }

    var remoteUrl = getRemoteUrl(absPath);
    remoteUrl = getRemoteUrl(absPath);
    const repoName = extractRepoName(remoteUrl);
    const branch = getCurrentBranch(absPath);
    const remoteType = getRemoteType(remoteUrl);

    if (!remoteType) {
      throw new Error("Unable to determine remote type.");
    }

    const options = {
      method: "POST",
      headers: {
        Authorization: `Bearer ${greptileToken}`,
        "X-GitHub-Token": githubToken,
        "Content-Type": "application/json",

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Open an actual folder/workspace in the IDE and retry
  2. Verify other providers that need workspace dirs (e.g. codebase search) work, to confirm getWorkspaceDirs returns values
  3. Restart the extension if the workspace was just opened but the backend is stale
Defensive patterns

Strategy: validation

Validate before calling

const dirs = await ide.getWorkspaceDirs();
if (dirs.length === 0) { /* don't invoke greptile */ }

Prevention

When it happens

Trigger: Running the greptile provider when the IDE reports zero workspace directories (no folder open, or a remote/empty workspace).

Common situations: Using Continue in a single-file mode or a blank VS Code window; the workspace dir call failing silently and returning undefined.

Related errors


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