{"record":{"id":"459ec6737e498ea2","repo":"linshenkx/prompt-optimizer","slug":"model-metadata-cannot-be-empty","errorCode":null,"errorMessage":"Model metadata cannot be empty","messagePattern":"Model metadata cannot be empty","errorType":"validation","errorClass":"RequestConfigError","httpStatus":null,"severity":"error","filePath":"packages/core/src/services/image-understanding/service.ts","lineNumber":55,"sourceCode":"    await adapter.sendImageUnderstandingStream(runtimeRequest, request.modelConfig, callbacks)\n  }\n\n  private validateRequest(request: ImageUnderstandingExecutionRequest): void {\n    if (!request || typeof request !== 'object') {\n      throw new RequestConfigError('Image understanding request cannot be empty')\n    }\n\n    const modelConfig = request.modelConfig\n    if (!modelConfig) {\n      throw new RequestConfigError('Model config cannot be empty')\n    }\n\n    if (!modelConfig.providerMeta?.id) {\n      throw new RequestConfigError('Model provider metadata cannot be empty')\n    }\n\n    if (!modelConfig.modelMeta?.id) {\n      throw new RequestConfigError('Model metadata cannot be empty')\n    }\n\n    if (!modelConfig.enabled) {\n      throw new RequestConfigError('Model is not enabled')\n    }\n  }\n\n  private async prepareRuntimeRequest(\n    request: ImageUnderstandingExecutionRequest\n  ): Promise<ImageUnderstandingExecutionRequest> {\n    const images = await normalizeImageInputsForLlm(request.images, this.imageInputOptions)\n    return {\n      ...request,\n      images: images ?? request.images,\n    }\n  }\n}\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/core/src/services/image-understanding/service.ts#L37-L73","documentation":"Thrown by validateRequest when modelConfig.modelMeta is missing or has no id. The model metadata id selects the concrete model (e.g. which vision LLM) within the provider, so the service refuses requests without it.","triggerScenarios":"Passing a modelConfig that has providerMeta but no modelMeta, or modelMeta: {} without an id.","commonSituations":"Configs assembled from provider-level settings only; partial config objects after refactors; deserialization dropping nested fields.","solutions":["Set modelMeta: { id: '<model-id>', ... } on the config.","Retrieve the config from the model manager rather than hand-building it.","Add a runtime guard on restored configs checking modelMeta?.id before use."],"exampleFix":"// before\nmodelConfig = { providerMeta: { id: 'dashscope' }, enabled: true } // no modelMeta\n\n// after\nmodelConfig = {\n  providerMeta: { id: 'dashscope' },\n  modelMeta: { id: 'qwen2.5-vl-72b-instruct' },\n  enabled: true,\n}","handlingStrategy":"type-guard","validationCode":"if (!request.modelConfig.modelMeta?.id) {\n  throw new Error('modelConfig.modelMeta.id required')\n}","typeGuard":"const hasModelMeta = (c: any): c is { modelMeta: { id: string } } =>\n  typeof c?.modelMeta?.id === 'string' && c.modelMeta.id.length > 0","tryCatchPattern":null,"preventionTips":["Include modelMeta.id when assembling configs","Round-trip test serialized configs to catch dropped fields"],"tags":["validation","model-config","model-id"],"backgroundTag":"missing-required-config-field","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}