microsoft/TypeScript · error · Error

The project's language service is disabled.

Error message

The project's language service is disabled.

What it means

Thrown via Errors.ThrowProjectLanguageServiceDisabled() (utilitiesPublic.ts:62). It fires when a request requires the language service but the resolved Project has languageServiceEnabled === false — typically because the project exceeded configured resource thresholds (file count / memory) and was downgraded to a syntax-only project, or because the project type does not provide a language service.

Source

Thrown at src/server/utilitiesPublic.ts:62

export function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings {
    return {
        projectName: project.getProjectName(),
        fileNames: project.getFileNames(/*excludeFilesFromExternalLibraries*/ true, /*excludeConfigFiles*/ true).concat(project.getExcludedFiles() as NormalizedPath[]),
        compilerOptions: project.getCompilationSettings(),
        typeAcquisition,
        unresolvedImports,
        projectRootPath: project.getCurrentDirectory() as Path,
        cachePath,
        kind: "discover",
    };
}

export namespace Errors {
    export function ThrowNoProject(): never {
        throw new Error("No Project.");
    }
    export function ThrowProjectLanguageServiceDisabled(): never {
        throw new Error("The project's language service is disabled.");
    }
    export function ThrowProjectDoesNotContainDocument(fileName: string, project: Project): never {
        throw new Error(`Project '${project.getProjectName()}' does not contain document '${fileName}'`);
    }
}

export type NormalizedPath = string & { __normalizedPathTag: any; };

export function toNormalizedPath(fileName: string): NormalizedPath {
    return normalizePath(fileName) as NormalizedPath;
}

export function normalizedPathToPath(normalizedPath: NormalizedPath, currentDirectory: string, getCanonicalFileName: (f: string) => string): Path {
    const f = isRootedDiskPath(normalizedPath) ? normalizedPath : getNormalizedAbsolutePath(normalizedPath, currentDirectory);
    return getCanonicalFileName(f) as Path;
}

export function asNormalizedPath(fileName: string): NormalizedPath {

View on GitHub (pinned to b465fdbfe1)

Solutions

  1. Raise the resource limits in tsserver configuration (maxTsServerMemory, maxProjectFileCount) so the project qualifies for a language service.
  2. Split the oversized project into smaller tsconfigs (project references) so each stays under the threshold.
  3. Move the file into a configured project (tsconfig.json include) instead of an inferred/external project.
  4. Restart tsserver after changing limits so the project reloads with language service re-enabled.
  5. On the client, surface a clear 'language service disabled for this project' UX instead of letting the request throw.

Example fix

// before — large project trips the threshold
// tsserver started with default limits; project downgraded to syntax-only

// after — raise limits and restart
// editor settings / tsserver config:
//   maxTsServerMemory: 8192
//   maxProjectFileCount: 50000
// then restart the language server
Defensive patterns

Strategy: validation

Validate before calling

// Check the project's language-service flag before issuing requests.
function ensureLanguageServiceEnabled(project: Project): void {
  if (!project.languageServiceEnabled) {
    throw new Error(`Language service disabled for ${project.getProjectName()}. Raise limits or split the project.`);
  }
}

Type guard

function projectHasLanguageService(project: Project): boolean {
  return project.languageServiceEnabled === true;
}

Prevention

When it happens

Trigger: A project exceeds the file-count or memory ceiling (e.g. maxTsServerMemory, maxProjectFileCount) and tsserver disables its language service; the client then issues a language-service command for a file in that project, which routes through ThrowProjectLanguageServiceDisabled.

Common situations: Very large monorepos where one configured project crosses the threshold; tight memory limits in the editor; an inferred/external project that does not get a language service; a downgraded project after the user added many files.

Related errors


AI-assisted analysis of microsoft/TypeScript@b465fdbfe1 (2026-08-12). Data as JSON: /api/errors/8308602fe4b4798a. Report an issue: GitHub.