{"record":{"id":"07c66343428ecc44","repo":"microsoft/TypeScript","slug":"no-project","errorCode":null,"errorMessage":"No Project.","messagePattern":"No Project\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/server/utilitiesPublic.ts","lineNumber":59,"sourceCode":"    Perf = \"Perf\",\r\n}\r\n\r\nexport function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings {\r\n    return {\r\n        projectName: project.getProjectName(),\r\n        fileNames: project.getFileNames(/*excludeFilesFromExternalLibraries*/ true, /*excludeConfigFiles*/ true).concat(project.getExcludedFiles() as NormalizedPath[]),\r\n        compilerOptions: project.getCompilationSettings(),\r\n        typeAcquisition,\r\n        unresolvedImports,\r\n        projectRootPath: project.getCurrentDirectory() as Path,\r\n        cachePath,\r\n        kind: \"discover\",\r\n    };\r\n}\r\n\r\nexport namespace Errors {\r\n    export function ThrowNoProject(): never {\r\n        throw new Error(\"No Project.\");\r\n    }\r\n    export function ThrowProjectLanguageServiceDisabled(): never {\r\n        throw new Error(\"The project's language service is disabled.\");\r\n    }\r\n    export function ThrowProjectDoesNotContainDocument(fileName: string, project: Project): never {\r\n        throw new Error(`Project '${project.getProjectName()}' does not contain document '${fileName}'`);\r\n    }\r\n}\r\n\r\nexport type NormalizedPath = string & { __normalizedPathTag: any; };\r\n\r\nexport function toNormalizedPath(fileName: string): NormalizedPath {\r\n    return normalizePath(fileName) as NormalizedPath;\r\n}\r\n\r\nexport function normalizedPathToPath(normalizedPath: NormalizedPath, currentDirectory: string, getCanonicalFileName: (f: string) => string): Path {\r\n    const f = isRootedDiskPath(normalizedPath) ? normalizedPath : getNormalizedAbsolutePath(normalizedPath, currentDirectory);\r\n    return getCanonicalFileName(f) as Path;\r","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/microsoft/TypeScript/blob/b465fdbfe175304d9b977da137b2c178ae1091d3/src/server/utilitiesPublic.ts#L41-L77","documentation":"Thrown via Errors.ThrowNoProject() (utilitiesPublic.ts:59), a shared `never`-returning helper invoked across editorServices.ts:1853, scriptInfo.ts:578/581/622, and several Session handlers (session.ts:2146/2159/2171/2622/2905/3330). It signals that a request needs an active Project for a file/script and none could be resolved — either no project owns the file or all candidate projects were unloaded.","triggerScenarios":"A protocol request (e.g. geterr, completions, definition) is dispatched for a file that has not been opened in any configured project, or whose project was closed by the ProjectService. The session handler calls getProject(...) / ScriptInfo.containingProjects paths that bottom out at ThrowNoProject.","commonSituations":"Editor sends a request before opening the project / tsconfig; the file is outside any project root; the project was unloaded due to a tsconfig error; orphaned script info after a project reload; client race during project reload.","solutions":["Open the file's project before issuing requests: send projectOpen/open with the tsconfig or open the file via the `open` command so the ProjectService loads an owning project.","Confirm the file path is inside a configured project root (and matches the tsconfig include/includePath).","Inspect tsserver logs for project-load failures (tsconfig errors, parse errors) that left the file orphaned, and fix the root cause.","Restart tsserver if the project was unloaded by a transient error.","On the client, retry after the `projectLoadingFinish` event rather than racing ahead."],"exampleFix":"// before — request issued for an unopened file\nclient.send({ command: 'quickinfo', arguments: { file: '/proj/a.ts', line: 1, offset: 1 } });\n// throws: No Project.\n\n// after — open the file first so a project is loaded\nclient.send({ command: 'open', arguments: { file: '/proj/a.ts', fileContent: '' } });\nawait waitForEvent('projectLoadingFinish');\nclient.send({ command: 'quickinfo', arguments: { file: '/proj/a.ts', line: 1, offset: 1 } });","handlingStrategy":"validation","validationCode":"// Verify a project is loaded for the file before issuing the request.\nfunction ensureProjectForFile(projectService: ProjectService, fileName: string): Project {\n  const project = projectService.getDefaultProjectForFile(fileName as NormalizedPath)\n    || projectService.getLoadingProjectForFile(fileName as NormalizedPath);\n  if (!project) throw new Error(`No project loaded for ${fileName}. Open the file/project first.`);\n  return project;\n}","typeGuard":"function fileHasProject(projectService: ProjectService, fileName: string): boolean {\n  return !!projectService.getDefaultProjectForFile(fileName as NormalizedPath)\n      || !!projectService.getLoadingProjectForFile(fileName as NormalizedPath);\n}","tryCatchPattern":null,"preventionTips":["Send the `open` command for a file before any language-service request.","Wait for the projectLoadingFinish event before issuing requests.","Confirm the file path is inside a configured project root."],"tags":["server","tsserver","project","lifecycle"],"backgroundTag":null,"analyzedSha":"b465fdbfe175304d9b977da137b2c178ae1091d3","analyzedAt":"2026-08-12T05:38:42.698Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}