{"record":{"id":"a0e9a40bd8343f8d","repo":"linshenkx/prompt-optimizer","slug":"model-provider-metadata-cannot-be-empty","errorCode":null,"errorMessage":"Model provider metadata cannot be empty","messagePattern":"Model provider metadata cannot be empty","errorType":"validation","errorClass":"RequestConfigError","httpStatus":null,"severity":"error","filePath":"packages/core/src/services/image-understanding/service.ts","lineNumber":51,"sourceCode":"    const providerId = request.modelConfig.providerMeta.id\n    const adapter = this.registry.getAdapter(providerId)\n    const runtimeRequest = await this.prepareRuntimeRequest(request)\n\n    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,","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/core/src/services/image-understanding/service.ts#L33-L69","documentation":"Thrown by validateRequest when modelConfig.providerMeta is missing or has no id. The provider metadata id identifies which provider adapter (OpenAI, DashScope, etc.) handles the request, so it is mandatory.","triggerScenarios":"Passing a modelConfig where providerMeta was omitted ({ model: {...}, modelMeta: {...} } with no providerMeta) or providerMeta exists but lacks id.","commonSituations":"Constructing model configs manually instead of retrieving them from the model manager; serializing configs to JSON and losing providerMeta on deserialization; provider records built without an id.","solutions":["Use model configs obtained from ImageModelManager, which guarantees providerMeta.id is set.","If building manually, include providerMeta: { id: 'dashscope', ... } with the provider id.","Validate deserialized configs (zod/schema) before sending them to understand()."],"exampleFix":"// before\nmodelConfig = { modelMeta: { id: 'qwen-vl' }, enabled: true } // no providerMeta\n\n// after\nmodelConfig = {\n  providerMeta: { id: 'dashscope' },\n  modelMeta: { id: 'qwen-vl' },\n  enabled: true,\n}","handlingStrategy":"type-guard","validationCode":"if (!request.modelConfig.providerMeta?.id) {\n  throw new Error('modelConfig.providerMeta.id required')\n}","typeGuard":"const hasProviderMeta = (c: any): c is { providerMeta: { id: string } } =>\n  typeof c?.providerMeta?.id === 'string' && c.providerMeta.id.length > 0","tryCatchPattern":null,"preventionTips":["Prefer manager-provided configs over hand-built ones","Validate deserialized configs before use"],"tags":["validation","model-config","provider"],"backgroundTag":"missing-required-config-field","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}