siyuan-note/siyuan · error

no AI editing model configured

Error message

no AI editing model configured

What it means

After confirming some provider exists, NewAIEditorChatStream (kernel/model/ai.go:162) calls Conf.AI.GetEditingModel(); if it returns a nil provider or nil model the AI editor has no model to send requests to and the constructor aborts. This happens when the dedicated editing model was never selected, or the selected model's provider/model no longer exists in configuration.

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 afa823b6b4)

Solutions

  1. Open 设置 - 人工智能 and explicitly select an editing model (编辑模型), then save
  2. If the previously selected model's provider was removed, re-add the provider or re-select a model that currently exists
  3. Retry the AI editor action after saving

Example fix

// before: providers configured but editingModel unset -> "no AI editing model configured"
// after: in 设置 - 人工智能 choose Editing model = "gpt-4o-mini" (an existing provider model), save, retry
Defensive patterns

Strategy: validation

Validate before calling

if prov, m := Conf.AI.GetEditingModel(); prov == nil || m == nil {
    // editing model not selected or dangling: block the action and prompt setup
    promptSelectEditingModel()
    return
}

Try / catch

if err != nil && err.Error() == "no AI editing model configured" {
    openAISettings(section: "editing-model")
    return
}

Prevention

When it happens

Trigger: AI editor request when the editing model field is empty, or when it still points at a model whose provider was deleted or renamed. Distinct from error 363: providers exist, but none is bound as the editing model.

Common situations: Users who configured a chat model but never picked the separate editing model; deleting or renaming a provider while the editing-model reference still points at it; config restored from an older backup.

Related errors


AI-assisted analysis of siyuan-note/siyuan@afa823b6b4 (2026-08-18). Data as JSON: /api/errors/a64c3156762bd1ea. Report an issue: GitHub.