You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: improve error handling for LMStudio model compatibility
- Add specific error detection for connection failures
- Add model not found error handling
- Add context length exceeded error handling
- Provide clearer error messages for debugging
- Update tests to cover new error scenarios
Fixes#8575
`Cannot connect to LM Studio at ${this.options.lmStudioBaseUrl||"http://localhost:1234"}. Please ensure LM Studio is running and the server is started.`,
107
+
)
108
+
}
109
+
110
+
// Check for model not found errors
111
+
if(
112
+
errorMessage.includes("model")&&
113
+
(errorMessage.includes("not found")||errorMessage.includes("does not exist"))
114
+
){
115
+
thrownewError(
116
+
`Model "${this.getModel().id}" not found in LM Studio. Please ensure the model is loaded in LM Studio.`,
117
+
)
118
+
}
119
+
120
+
// Check for context length errors
121
+
if(
122
+
errorMessage.includes("context")||
123
+
errorMessage.includes("token")||
124
+
errorMessage.includes("length")
125
+
){
126
+
thrownewError(
127
+
`Context length exceeded for model "${this.getModel().id}". Please load the model with a larger context window in LM Studio, or use a different model that supports longer contexts.`,
128
+
)
129
+
}
130
+
131
+
// Use the enhanced error handler for other OpenAI-like errors
"Please check the LM Studio developer logs to debug what went wrong. You may need to load the model with a larger context length to work with Roo Code's prompts.",
180
+
`LM Studio error: ${errorinstanceofError ? error.message : String(error)}. Please check the LM Studio developer logs for more details.`,
`Cannot connect to LM Studio at ${this.options.lmStudioBaseUrl||"http://localhost:1234"}. Please ensure LM Studio is running and the server is started.`,
226
+
)
227
+
}
228
+
229
+
// Check for model not found errors
230
+
if(
231
+
errorMessage.includes("model")&&
232
+
(errorMessage.includes("not found")||errorMessage.includes("does not exist"))
233
+
){
234
+
thrownewError(
235
+
`Model "${this.getModel().id}" not found in LM Studio. Please ensure the model is loaded in LM Studio.`,
236
+
)
237
+
}
238
+
239
+
// Check for context length errors
240
+
if(
241
+
errorMessage.includes("context")||
242
+
errorMessage.includes("token")||
243
+
errorMessage.includes("length")
244
+
){
245
+
thrownewError(
246
+
`Context length exceeded for model "${this.getModel().id}". Please load the model with a larger context window in LM Studio, or use a different model that supports longer contexts.`,
247
+
)
248
+
}
249
+
250
+
// Use the enhanced error handler for other OpenAI-like errors
181
251
throwhandleOpenAIError(error,this.providerName)
182
252
}
183
253
returnresponse.choices[0]?.message.content||""
184
254
}catch(error){
255
+
// If error was already processed and re-thrown above, just re-throw it
"Please check the LM Studio developer logs to debug what went wrong. You may need to load the model with a larger context length to work with Roo Code's prompts.",
262
+
`LM Studio error: ${errorinstanceofError ? error.message : String(error)}. Please check the LM Studio developer logs for more details.`,
0 commit comments