{"record":{"id":"be871133f0768e14","repo":"siyuan-note/siyuan","slug":"image-model-is-not-configured","errorCode":null,"errorMessage":"image model is not configured","messagePattern":"image model is not configured","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/assets.go","lineNumber":481,"sourceCode":"\treturn GenerateDocumentImageResult{\n\t\tArtifact: ImageArtifactRef{\n\t\t\tKind: \"image\", Path: assetPath, MIMEType: generated.MIMEType, DocumentID: bt.RootID,\n\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}","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/assets.go#L463-L499","documentation":"Returned by validateImageModel when Conf.AI.GetImageGenerationModel() returned nil provider or nil model. GetImageGenerationModel returns nil,nil if AI.ImageGeneration is nil, if ImageGeneration.ModelID is empty, or if GetModel cannot find the referenced model in any provider. The image-generation feature therefore has no target model configured.","triggerScenarios":"Conf.AI.ImageGeneration.ModelID is unset; the referenced model ID no longer exists in any provider (deleted by the user); ImageGeneration block is missing from conf.json; the provider containing the model was disabled.","commonSituations":"User never selected an image-generation model in settings; a conf.json edit removed the model; the model's parent provider was toggled off; a conf migration reset ImageGeneration.ModelID.","solutions":["Open Settings - AI - Image generation and select a model, or set Conf.AI.ImageGeneration.ModelID programmatically.","Ensure the chosen model belongs to an enabled provider and is itself enabled.","Run ReconcileModelIDs to clean stale references, then pick a fresh model."],"exampleFix":"// before\nres, err := model.GenerateImage(ctx, req)\n\n// after — verify a model is configured first\nif p, m := model.Conf.AI.GetImageGenerationModel(); p == nil || m == nil {\n    return errors.New(\"no image-generation model configured\")\n}\nres, err := model.GenerateImage(ctx, req)","handlingStrategy":"validation","validationCode":"if p, m := model.Conf.AI.GetImageGenerationModel(); p == nil || m == nil {\n    return errors.New(\"no image-generation model configured\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Require an image-generation model selection in settings before enabling the feature.","Run ReconcileModelIDs after provider/model edits to clear stale references.","Disable the UI entry point when no model is configured."],"tags":["config","ai","model-config"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}