{"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":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/assets.go","lineNumber":593,"sourceCode":"\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 != util.OpenAIProtocolChatCompletions &&\n\t\tprovider.Protocol != util.OpenAIProtocolResponses {\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":575,"sourceCodeEnd":611,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/assets.go#L575-L611","documentation":"validateImageModel checks the AI image-generation provider's configured protocol before calling it. SiYuan only supports the OpenAI chat-completions and OpenAI responses protocols for multimodal (image) providers; when the provider's Protocol field is set to any other non-empty value, this error is thrown and image generation is aborted. An empty Protocol is allowed and treated as the default chat-completions protocol.","triggerScenarios":"Calling GenerateImage with a conf.Provider whose Protocol field is a non-empty string other than util.OpenAIProtocolChatCompletions or util.OpenAIProtocolResponses (e.g. a hand-edited or plugin-written provider config with protocol \"ollama\", \"gemini\", \"azure\", or a typo like \"chat-completions\").","commonSituations":"Users copy a provider config from another tool that uses different protocol names (e.g. \"anthropic\", \"google-ai\"), manually edit conf.json to add a provider without knowing the exact accepted strings, or a sync/version change introduces a provider entry with a newer protocol value the running kernel build does not recognize.","solutions":["Open the provider settings and change the protocol to one of the supported values (OpenAI chat-completions or responses), or clear the protocol field to use the default","If editing conf.json directly, set the provider's \"protocol\" to exactly the supported constant or remove the key entirely","If the provider genuinely only speaks another protocol, route it through an OpenAI-compatible proxy/gateway that exposes chat-completions or responses endpoints","Update the kernel to a version that supports the protocol string if it was introduced in a newer release"],"exampleFix":"// before\nprovider.Protocol = \"anthropic\"\n// after\nprovider.Protocol = \"openai-chat-completions\" // or \"openai-responses\", or \"\" for default","handlingStrategy":"validation","validationCode":"func validImageProtocol(p *conf.Provider) bool {\n    return p == nil || p.Protocol == \"\" || p.Protocol == util.OpenAIProtocolChatCompletions || p.Protocol == util.OpenAIProtocolResponses\n}","typeGuard":"func isOpenAIProtocol(p *conf.Provider) bool {\n    return p != nil && (p.Protocol == \"\" || p.Protocol == util.OpenAIProtocolChatCompletions || p.Protocol == util.OpenAIProtocolResponses)\n}","tryCatchPattern":"if err := model.ValidateImageModel(provider, imageModel); err != nil {\n    if strings.HasPrefix(err.Error(), \"unsupported multimodal provider protocol\") {\n        // fall back to a known-good provider or surface a config-fix message\n    }\n    return err\n}","preventionTips":["Configure image providers only through the settings UI so the protocol field gets a valid value","Keep provider Protocol empty unless you specifically need the responses protocol","When sharing configs across tools, rename protocol values to the ones this library accepts before importing"],"tags":["ai","configuration","unsupported-protocol","image-generation"],"backgroundTag":"invalid-enum-value","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}