linshenkx/prompt-optimizer · error · RequestConfigError
Model is not enabled
Error message
Model is not enabled
What it means
Thrown by validateRequest when modelConfig.enabled is falsy. The service only executes enabled models; a disabled config (user toggled it off, or imported with enabled:false) is rejected before any network call.
Source
Thrown at packages/core/src/services/image-understanding/service.ts:59
if (!request || typeof request !== 'object') {
throw new RequestConfigError('Image understanding request cannot be empty')
}
const modelConfig = request.modelConfig
if (!modelConfig) {
throw new RequestConfigError('Model config cannot be empty')
}
if (!modelConfig.providerMeta?.id) {
throw new RequestConfigError('Model provider metadata cannot be empty')
}
if (!modelConfig.modelMeta?.id) {
throw new RequestConfigError('Model metadata cannot be empty')
}
if (!modelConfig.enabled) {
throw new RequestConfigError('Model is not enabled')
}
}
private async prepareRuntimeRequest(
request: ImageUnderstandingExecutionRequest
): Promise<ImageUnderstandingExecutionRequest> {
const images = await normalizeImageInputsForLlm(request.images, this.imageInputOptions)
return {
...request,
images: images ?? request.images,
}
}
}
export function createImageUnderstandingService(
options: CreateImageUnderstandingServiceOptions = {}
): IImageUnderstandingService {
return new ImageUnderstandingService(options)View on GitHub (pinned to 3e677b1d9f)
Solutions
- Enable the model via the model manager / settings UI before calling understand().
- When creating configs programmatically, set enabled: true explicitly.
- Filter candidate models to enabled ones before building the request.
Example fix
// before
modelConfig = { providerMeta: { id: 'x' }, modelMeta: { id: 'y' }, enabled: false }
await service.understand({ modelConfig, ... })
// after
await modelManager.setEnabled('x', 'y', true)
await service.understand({ modelConfig: await modelManager.getEnabledModel('x','y'), ... }) Defensive patterns
Strategy: validation
Validate before calling
const cfg = request.modelConfig
if (!cfg.enabled) {
cfg.enabled = true // or pick another enabled model
} Type guard
const isEnabledModel = (c: any): boolean => Boolean(c?.enabled) && Boolean(c?.modelMeta?.id) && Boolean(c?.providerMeta?.id)
Prevention
- Filter model candidates by enabled before building requests
- Sync UI toggle state with the config actually used
When it happens
Trigger: Calling understand/understandStream with a config whose enabled flag is false or undefined; using a model the user disabled in settings; freshly imported configs defaulting to disabled.
Common situations: UI toggle state out of sync with the code path that picks the model; importing configs where enabled was not carried over; new configs created without setting enabled: true.
Related errors
- Data must be an object
- Model config cannot be empty
- Model provider metadata cannot be empty
- Model metadata cannot be empty
- Model provider metadata cannot be empty
AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27).
Data as JSON: /api/errors/a6e1c6210df66640.
Report an issue: GitHub.