[Bug] Error: [createInstance] CodeLensContribution depends on UNKNOWN service ICodeLensCache.

Author: chadsowaldCreated Sep 29, 2026Updated Sep 29, 2026

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

I'm using 0.57.0 along with monaco-editor-webpack-plugin.

My monaco-editor-webpack-plugin config looks like this:

new MonacoWebpackPlugin({
	languages: ['json', 'html', 'javascript'],
	filename: getFileName('js', 'worker'),
	features: [
		'!caretOperations',
		'!codeAction',
		'!codelens',    // BUG RELATED
		'!colorPicker',
		'!dnd',
		'!gotoSymbol',
		'!linkedEditing',
		'!multicursor',
		'!referenceSearch',
		'!smartSelect',
		'!snippet',
		'!stickyScroll',
		'!toggleHighContrast',
		'!inlineCompletions',
		'!inlineProgress',
	]
})

I create Monaco editors with this config:

bash
export const defaultEditorOptions = {
	minimap: { enabled: false },
	scrollBeyondLastLine: false,
	lineNumbers: 'off',
	renderLineHighlight: 'none',
	selectOnLineNumbers: true,
	automaticLayout: true,
	theme: 'defaultTheme',
	scrollbar: { alwaysConsumeMouseWheel: false },
	renderValidationDecorations: 'on',
	codeLens: false,      // BUG RELATED
};

When I instantiate an editor, it does render on my page but sometimes without styling the text. Furthermore, there are console errors like this. I was previously on 0.52.0 and didn't have this problem. I ran into it while testing the upgrade to 0.57.0.

errors.js:15 Uncaught Error: [createInstance] CodeLensContribution depends on UNKNOWN service ICodeLensCache.

Error: [createInstance] CodeLensContribution depends on UNKNOWN service ICodeLensCache.
    at InstantiationService._throwIfStrict (instantiationService.js:333:1)
    at InstantiationService._createInstance (instantiationService.js:114:1)
    at InstantiationService.createInstance (instantiationService.js:102:1)
    at CodeEditorContributions._instantiateById (codeEditorContributions.js:120:1)
    at CodeEditorContributions._instantiateSome (codeEditorContributions.js:98:1)
    at eval (codeEditorContributions.js:46:1)
    at InstantiationService._throwIfStrict (instantiationService.js:333:1)
    at InstantiationService._createInstance (instantiationService.js:114:1)
    at InstantiationService.createInstance (instantiationService.js:102:1)
    at CodeEditorContributions._instantiateById (codeEditorContributions.js:120:1)
    at CodeEditorContributions._instantiateSome (codeEditorContributions.js:98:1)
    at eval (codeEditorContributions.js:46:1)
    at eval (errors.js:15:1)

I would expect since I have codeLens disabled in webpack and codeLens disabled on the editor options, that nothing would try to instantiate codeLens! Debugging in my browser, I see "css.editor.codeLens" is the ID trying to create it, which also makes no sense since I never tell Monaco to use CSS:

Image

Monaco Editor Playground Code

typescript

Reproduction Steps

No response

Actual (Problematic) Behavior

No response

Expected Behavior

No response

Additional Context

No response