{"record":{"id":"d49af4198a048ed9","repo":"microsoft/TypeScript","slug":"getpreprocessedfileinfo-is-not-available-using-the","errorCode":null,"errorMessage":"getPreProcessedFileInfo is not available using the server interface.","messagePattern":"getPreProcessedFileInfo is not available using the server interface\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/harness/harnessLanguageService.ts","lineNumber":810,"sourceCode":"\r\n        // Set the properties\r\n        this.client = client;\r\n        this.host = clientHost;\r\n    }\r\n    getLogger(): LoggerWithInMemoryLogs {\r\n        return this.logger;\r\n    }\r\n    getHost(): SessionClientHost {\r\n        return this.host;\r\n    }\r\n    getLanguageService(): ts.LanguageService {\r\n        return this.client;\r\n    }\r\n    getClassifier(): ts.Classifier {\r\n        throw new Error(\"getClassifier is not available using the server interface.\");\r\n    }\r\n    getPreProcessedFileInfo(): ts.PreProcessedFileInfo {\r\n        throw new Error(\"getPreProcessedFileInfo is not available using the server interface.\");\r\n    }\r\n    assertTextConsistent(fileName: string): void {\r\n        const serverText = this.server.getText(fileName);\r\n        const clientText = this.host.readFile(fileName);\r\n        ts.Debug.assert(\r\n            serverText === clientText,\r\n            [\r\n                \"Server and client text are inconsistent.\",\r\n                \"\",\r\n                \"\\x1b[1mServer\\x1b[0m\\x1b[31m:\",\r\n                serverText,\r\n                \"\",\r\n                \"\\x1b[1mClient\\x1b[0m\\x1b[31m:\",\r\n                clientText,\r\n                \"\",\r\n                \"This probably means something is wrong with the fourslash infrastructure, not with the test.\",\r\n            ].join(ts.sys.newLine),\r\n        );\r","sourceCodeStart":792,"sourceCodeEnd":828,"githubUrl":"https://github.com/microsoft/TypeScript/blob/b465fdbfe175304d9b977da137b2c178ae1091d3/src/harness/harnessLanguageService.ts#L792-L828","documentation":"Thrown by the server-backed language service adapter (harnessLanguageService.ts:810) when a test invokes getPreProcessedFileInfo(). Like getClassifier (error 70), pre-processing of a file into triple-slash/reference/module info is a compiler-internal routine the tsserver protocol does not surface, so the server adapter refuses the call.","triggerScenarios":"A test that exercises pre-processing (e.g. triple-slash reference detection, import scanning) is run against the Session/SessionClientHost adapter instead of the in-process LanguageService.","commonSituations":"Sharing a pre-processing test across adapter variants; migrating a test to the server harness without removing the getPreProcessedFileInfo call; asserting on internal module-detection state.","solutions":["Restrict getPreProcessedFileInfo tests to the in-process language service adapter; skip the server variant.","For server-side coverage, drive equivalent behaviour through protocol commands (e.g. geterr / NavTree) that surface the same underlying parsing.","Split the test so the server variant asserts only protocol-exposed behaviour."],"exampleFix":"// before\nconst info = adapter.getPreProcessedFileInfo(\"/a.ts\");\nassert.deepEqual(info.referencedFiles, []);\n\n// after — only run on the in-process adapter\nif (!isServerAdapter(adapter)) {\n  const info = adapter.getPreProcessedFileInfo(\"/a.ts\");\n  assert.deepEqual(info.referencedFiles, []);\n}","handlingStrategy":"type-guard","validationCode":"// Detect server-backed adapters and skip pre-processing tests for them.\nfunction supportsPreProcessedFileInfo(adapter: unknown): boolean {\n  return typeof (adapter as any).getPreProcessedFileInfo === 'function' && !isServerAdapter(adapter);\n}","typeGuard":"function isServerAdapter(adapter: unknown): boolean {\n  return typeof (adapter as any)?.getHost === 'function' && !(adapter as any)._preProcessorAvailable;\n}","tryCatchPattern":null,"preventionTips":["Restrict getPreProcessedFileInfo tests to in-process adapters.","Drive equivalent server-side checks through protocol commands.","Split shared test bodies so server variants skip compiler-internal calls."],"tags":["test-harness","language-service","server-adapter","unsupported-api"],"backgroundTag":null,"analyzedSha":"b465fdbfe175304d9b977da137b2c178ae1091d3","analyzedAt":"2026-08-12T05:38:42.698Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}