{"record":{"id":"db2a6b627f7994f7","repo":"continuedev/continue","slug":"failed-to-determine-the-workspace-directory","errorCode":null,"errorMessage":"Failed to determine the workspace directory.","messagePattern":"Failed to determine the workspace directory\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/context/providers/GreptileContextProvider.ts","lineNumber":40,"sourceCode":"  }\n\n  async getContextItems(\n    query: string,\n    extras: ContextProviderExtras,\n  ): Promise<ContextItem[]> {\n    const greptileToken = this.getGreptileToken();\n    if (!greptileToken) {\n      throw new Error(\"Greptile token not found.\");\n    }\n\n    const githubToken = this.getGithubToken();\n    if (!githubToken) {\n      throw new Error(\"GitHub token not found.\");\n    }\n\n    let absPath = await this.getWorkspaceDir(extras);\n    if (!absPath) {\n      throw new Error(\"Failed to determine the workspace directory.\");\n    }\n\n    var remoteUrl = getRemoteUrl(absPath);\n    remoteUrl = getRemoteUrl(absPath);\n    const repoName = extractRepoName(remoteUrl);\n    const branch = getCurrentBranch(absPath);\n    const remoteType = getRemoteType(remoteUrl);\n\n    if (!remoteType) {\n      throw new Error(\"Unable to determine remote type.\");\n    }\n\n    const options = {\n      method: \"POST\",\n      headers: {\n        Authorization: `Bearer ${greptileToken}`,\n        \"X-GitHub-Token\": githubToken,\n        \"Content-Type\": \"application/json\",","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/context/providers/GreptileContextProvider.ts#L22-L58","documentation":"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.","triggerScenarios":"Running the greptile provider when the IDE reports zero workspace directories (no folder open, or a remote/empty workspace).","commonSituations":"Using Continue in a single-file mode or a blank VS Code window; the workspace dir call failing silently and returning undefined.","solutions":["Open an actual folder/workspace in the IDE and retry","Verify other providers that need workspace dirs (e.g. codebase search) work, to confirm getWorkspaceDirs returns values","Restart the extension if the workspace was just opened but the backend is stale"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const dirs = await ide.getWorkspaceDirs();\nif (dirs.length === 0) { /* don't invoke greptile */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard providers that need a repo behind a workspace-dir check","Open a folder before using repo-dependent providers"],"tags":["workspace","ide","greptile"],"backgroundTag":"no-workspace-directory","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}