{"record":{"id":"ead0b71668a05afe","repo":"siyuan-note/siyuan","slug":"unsupported-multimodal-provider-protocol-s","errorCode":null,"errorMessage":"unsupported multimodal provider protocol: %s","messagePattern":"unsupported multimodal provider protocol: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/assets.go","lineNumber":484,"sourceCode":"\t\t},\n\t\tRevisedPrompt: generated.RevisedPrompt,\n\t}, nil\n}\n\nfunc resolveMultimodalDocument(documentID string) (*treenode.BlockTree, error) {\n\tbt := treenode.GetBlockTree(strings.TrimSpace(documentID))\n\tif bt == nil {\n\t\treturn nil, errors.New(\"document not found: \" + documentID)\n\t}\n\treturn bt, nil\n}\n\nfunc validateImageModel(provider *conf.Provider, imageModel *conf.Model) error {\n\tif provider == nil || imageModel == nil {\n\t\treturn errors.New(\"image model is not configured\")\n\t}\n\tif provider.Protocol != \"\" && provider.Protocol != \"openai\" {\n\t\treturn fmt.Errorf(\"unsupported multimodal provider protocol: %s\", provider.Protocol)\n\t}\n\treturn nil\n}\n\nfunc documentReferencesImage(rootID, assetPath string) bool {\n\tpaths, err := DocImageAssets(rootID)\n\tif err != nil {\n\t\treturn false\n\t}\n\twanted := AssetPathWithoutQuery(assetPath)\n\tfor _, current := range paths {\n\t\tif AssetPathWithoutQuery(current) == wanted {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/assets.go#L466-L502","documentation":"Returned by validateImageModel when the resolved provider has a non-empty Protocol that is not \"openai\". The OpenAI image-generation adapter (util.NewOpenAIImageAdapter) only speaks the OpenAI /images/generations API, so providers declared with a different protocol (e.g. anthropic, google, custom) are rejected even if they have an image-capable model.","triggerScenarios":"Conf.AI.ImageGeneration.ModelID points at a model whose provider.Protocol = \"anthropic\" (or any non-openai/non-empty value); a provider was added with a custom protocol but selected for image generation.","commonSituations":"User picked a Claude/Gemini provider for image generation by mistake; a multi-protocol provider list selected the wrong entry; protocol field was set to a vendor name that the adapter doesn't understand.","solutions":["Select an OpenAI-protocol (or OpenAI-compatible, protocol=\"\") provider for image generation.","If using a compatible gateway, leave provider.Protocol empty (it defaults to openai behavior) or set it to \"openai\".","Move the image-generation model to an OpenAI-protocol provider entry."],"exampleFix":"// before — provider.Protocol = \"anthropic\"\nres, err := model.GenerateImage(ctx, req) // fails\n\n// after — use an openai-protocol provider\nprovider.Protocol = \"openai\" // or \"\" for default\nmodel.Conf.AI.ImageGeneration.ModelID = openAIProviderImageModelID\nres, err := model.GenerateImage(ctx, req)","handlingStrategy":"validation","validationCode":"p, _ := model.Conf.AI.GetImageGenerationModel()\nif p != nil && p.Protocol != \"\" && p.Protocol != \"openai\" {\n    return fmt.Errorf(\"provider protocol %q not supported for image generation\", p.Protocol)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only assign OpenAI-protocol (or empty-protocol) providers to image generation.","For OpenAI-compatible gateways, leave Protocol empty rather than naming a different vendor.","Validate provider.Protocol in settings when the user picks an image model."],"tags":["config","ai","provider","protocol"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}