siyuan-note/siyuan · error
no AI editing model configured
Error message
no AI editing model configured
What it means
After confirming a provider exists, NewAIEditorChatStream resolves the editing model via Conf.AI.GetEditingModel(); if either the provider or the model is nil, it returns "no AI editing model configured". The editor AI chat specifically requires an editing-capable model to be selected, distinct from merely having any provider.
Solutions
- Open Settings - AI and select an editing model (and its provider) for the editor chat feature
- Verify Conf.AI.GetEditingModel() resolves both provider and model — re-select the model if it points at a deleted provider
- Re-save AI settings to rebuild the provider/model references after config edits
- Check for config schema/version mismatch after upgrading if selection keeps getting lost
Example fix
// before
stream, err := model.NewAIEditorChatStream(ctx, ids, input, action, history) // fails: no editing model
// after
prov, m := conf.AI.GetEditingModel()
if prov == nil || m == nil {
return errors.New("select an AI editing model in Settings - AI first")
}
stream, err := model.NewAIEditorChatStream(ctx, ids, input, action, history) Defensive patterns
Strategy: validation
Validate before calling
prov, m := conf.AI.GetEditingModel()
if prov == nil || m == nil {
return errors.New("no AI editing model selected; set one in Settings - AI")
} Type guard
null
Try / catch
stream, err := model.NewAIEditorChatStream(ctx, ids, input, action, history)
if err != nil {
if strings.Contains(err.Error(), "no AI editing model configured") {
return promptUserToSelectEditingModel()
}
return err
} Prevention
- Select an editing model after adding any provider
- After editing config manually or syncing, verify the editing model still resolves to an existing provider
- Prompt users to pick a model instead of assuming defaults exist
- Re-save AI settings after upgrades that change provider/model schema
When it happens
Trigger: Calling the aiEditorChat contract endpoint when providers exist but the editing model (and/or its provider) is not selected in AI settings, or the selected model references a deleted provider.
Common situations: Provider added but no editing model chosen, editing model pointing to a removed/renamed provider entry after config edits, sync merging configs where the model selection was lost, upgrading with new config schema.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- AI configuration is unavailable
- image model is not configured
- no AI editing config
- no AI provider configured
- unsupported multimodal provider protocol
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/a64c3156762bd1ea.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/ai.go:162
err = errors.New("AI editor stream idle timeout")
}
return
}
func (stream *AIEditorChatStream) Close() {
stream.cancel()
stream.stream.Close()
}
// NewAIEditorChatStream 创建绑定到编辑器请求生命周期的模型流。
func NewAIEditorChatStream(ctx context.Context, ids []string, input, action string, history []AIEditorMessage) (*AIEditorChatStream, error) {
if !Conf.AI.HasAnyProvider() {
return nil, errors.New("no AI provider configured")
}
prov, m := Conf.AI.GetEditingModel()
if nil == prov || nil == m {
return nil, errors.New("no AI editing model configured")
}
editing := Conf.AI.Editing
if nil == editing {
return nil, errors.New("no AI editing config")
}
if "" == input && 0 < len(ids) {
input = getBlocksContent(ids)
}
prompt := BuildAIEditorPrompt(input, action)
if "" == strings.TrimSpace(prompt) {
return nil, errors.New("AI editor input is empty")
}
messages := buildAIEditorMessages(prompt, history, editing.MaxHistoryMessages)
req := openai.ChatCompletionRequest{
Model: m.Name,View on GitHub (pinned to 9f775e8a12)