Skip to content

fix: handle undefined initializationOptions in LSP params#371

Open
CatBraaain wants to merge 1 commit into
actions:mainfrom
CatBraaain:fix/initialization-options-undefined
Open

fix: handle undefined initializationOptions in LSP params#371
CatBraaain wants to merge 1 commit into
actions:mainfrom
CatBraaain:fix/initialization-options-undefined

Conversation

@CatBraaain

Copy link
Copy Markdown

Overview

This change handles the case where initializationOptions is optional and may be undefined, ensuring safe access by providing a default value.

Changes

// Before
const options = params.initializationOptions as InitializationOptions;

// After
const options = (params.initializationOptions ?? {}) as InitializationOptions;

Background

When running via CLI, a runtime error occurred

Server initialization failed.
Message: Request initialize failed with message: Cannot read properties of undefined (reading 'sessionToken')

@CatBraaain CatBraaain requested a review from a team as a code owner June 16, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant