microsoft/TypeScript · error · Error
getPreProcessedFileInfo is not available using the server in
Error message
getPreProcessedFileInfo is not available using the server interface.
What it means
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.
Source
Thrown at src/harness/harnessLanguageService.ts:810
// Set the properties
this.client = client;
this.host = clientHost;
}
getLogger(): LoggerWithInMemoryLogs {
return this.logger;
}
getHost(): SessionClientHost {
return this.host;
}
getLanguageService(): ts.LanguageService {
return this.client;
}
getClassifier(): ts.Classifier {
throw new Error("getClassifier is not available using the server interface.");
}
getPreProcessedFileInfo(): ts.PreProcessedFileInfo {
throw new Error("getPreProcessedFileInfo is not available using the server interface.");
}
assertTextConsistent(fileName: string): void {
const serverText = this.server.getText(fileName);
const clientText = this.host.readFile(fileName);
ts.Debug.assert(
serverText === clientText,
[
"Server and client text are inconsistent.",
"",
"\x1b[1mServer\x1b[0m\x1b[31m:",
serverText,
"",
"\x1b[1mClient\x1b[0m\x1b[31m:",
clientText,
"",
"This probably means something is wrong with the fourslash infrastructure, not with the test.",
].join(ts.sys.newLine),
);
View on GitHub (pinned to b465fdbfe1)
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.
Example fix
// before
const info = adapter.getPreProcessedFileInfo("/a.ts");
assert.deepEqual(info.referencedFiles, []);
// after — only run on the in-process adapter
if (!isServerAdapter(adapter)) {
const info = adapter.getPreProcessedFileInfo("/a.ts");
assert.deepEqual(info.referencedFiles, []);
} Defensive patterns
Strategy: type-guard
Validate before calling
// Detect server-backed adapters and skip pre-processing tests for them.
function supportsPreProcessedFileInfo(adapter: unknown): boolean {
return typeof (adapter as any).getPreProcessedFileInfo === 'function' && !isServerAdapter(adapter);
} Type guard
function isServerAdapter(adapter: unknown): boolean {
return typeof (adapter as any)?.getHost === 'function' && !(adapter as any)._preProcessorAvailable;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- getClassifier is not available using the server interface.
- No script with name '" + fileName + "'
- verifyCurrentLineContent\n
- verifyFileContent in file '${fileName}' failed:\n${showTextD
- Expected at least one js file to be emitted or at least one
AI-assisted analysis of microsoft/TypeScript@b465fdbfe1 (2026-08-12).
Data as JSON: /api/errors/d49af4198a048ed9.
Report an issue: GitHub.