{"record":{"id":"cf58193b474836cf","repo":"microsoft/typescript-go","slug":"project-not-found-for-open-s","errorCode":null,"errorMessage":"project not found for open: %s","messagePattern":"project not found for open: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/project/projectcollectionbuilder.go","lineNumber":175,"sourceCode":"\t\t\t\t\tprojectsToClose = make(map[tspath.Path]struct{})\n\t\t\t\t}\n\t\t\t\tprojectsToClose[projectPath] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\n\tif apiRequest.OpenProjects != nil {\n\t\tfor configFileName := range apiRequest.OpenProjects.Keys() {\n\t\t\tconfigPath := b.toPath(configFileName)\n\t\t\tif entry := b.findOrCreateProject(configFileName, configPath, projectLoadKindCreate, logger); entry != nil {\n\t\t\t\tif b.apiState.openProjects == nil {\n\t\t\t\t\tb.apiState.openProjects = make(map[tspath.Path]int)\n\t\t\t\t}\n\t\t\t\tb.apiState.openProjects[configPath]++\n\t\t\t\t// A project re-opened in the same request shouldn't be closed.\n\t\t\t\tdelete(projectsToClose, configPath)\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"project not found for open: %s\", configFileName)\n\t\t\t}\n\t\t}\n\t}\n\n\tif apiRequest.CloseFiles != nil {\n\t\tfor path := range apiRequest.CloseFiles.Keys() {\n\t\t\t// Ref-counted close mirroring projects above.\n\t\t\tif entry, ok := b.apiState.openFiles[path]; ok {\n\t\t\t\tif entry.refCount > 1 {\n\t\t\t\t\tentry.refCount--\n\t\t\t\t\tb.apiState.openFiles[path] = entry\n\t\t\t\t} else {\n\t\t\t\t\tdelete(b.apiState.openFiles, path)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/internal/project/projectcollectionbuilder.go#L157-L193","documentation":"Raised in project collection building when a config file name supplied via apiRequest.OpenProjects fails findOrCreateProject (returns nil), so the requested project cannot be created or located for opening. The API refuses to continue because the caller explicitly asked for a project that cannot be materialized — typically a nonexistent or unreadable tsconfig/jsconfig path.","triggerScenarios":"OpenProjects containing a path to a tsconfig.json that does not exist on disk; config path that exists but cannot be loaded/parsed by the config loader; relative vs absolute path mismatch after b.toPath conversion; symlinked config whose target is missing.","commonSituations":"API clients passing workspace-relative config paths where absolute paths are expected; project moved/renamed between discovery and open; stale config list from a previous scan; containerized setups with different mount paths.","solutions":["Verify each config file in OpenProjects exists and parses (valid JSON with expected fields) before sending the request","Use absolute canonical paths matching the server's file-layout view","Re-run project discovery and rebuild the open list rather than reusing a stale one"],"exampleFix":"// before\nreq.OpenProjects = collections.NewSet(tspath.Path(\"tsconfig.json\"))\n\n// after\nabs, _ := filepath.Abs(\"tsconfig.json\")\nif _, err := os.Stat(abs); err != nil { return err }\nreq.OpenProjects = collections.NewSet(tspath.Path(abs))","handlingStrategy":"validation","validationCode":"for cfg := range openProjects {\n\tabs, err := filepath.Abs(cfg)\n\tif err != nil { return err }\n\tif fi, err := os.Stat(abs); err != nil || fi.IsDir() {\n\t\treturn fmt.Errorf(\"config not openable: %s\", abs)\n\t}\n\t// optionally: json.Valid(mustRead(abs))\n}","typeGuard":null,"tryCatchPattern":"err := builder.Apply(apiRequest)\nif err != nil && strings.Contains(err.Error(), \"project not found for open\") {\n\t// drop the bad entry, revalidate paths, retry once with the cleaned set\n\tapiRequest.OpenProjects.Remove(offender)\n\treturn builder.Apply(apiRequest)\n}","preventionTips":["Send absolute, canonical config paths that exist on disk","Rebuild the project list from a fresh discovery scan instead of caches","Validate each tsconfig parses as JSON before requesting it be opened"],"tags":["project","config","api","path"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}