siyuan-note/siyuan · error

no AI editing config

Error message

no AI editing config

What it means

Returned by chatGPTComplete when Conf.AI.Editing is nil. Even if a provider/model is configured, the editing-specific settings block (temperature, maxCompletionTokens, MaxHistoryMessages, ModelID) must exist; its absence means the editing feature was never initialized. This is checked after the provider check, so reaching it implies GetEditingModel found a valid provider/model but the editing config object itself is missing.

Source

Thrown at kernel/model/ai.go:97

	if err != nil {
		return
	}
	return
}

func chatGPTComplete(msg string, contextMsgs []string, cloud bool) (ret string, retContextMsgs []string, err error) {
	util.PushEndlessProgress("Requesting...")
	defer util.ClearPushProgress(100)

	prov, m := Conf.AI.GetEditingModel()
	if nil == prov || nil == m {
		err = errors.New("no AI provider configured")
		return
	}

	editing := Conf.AI.Editing
	if nil == editing {
		err = errors.New("no AI editing config")
		return
	}

	if editing.MaxHistoryMessages < len(contextMsgs) {
		contextMsgs = contextMsgs[len(contextMsgs)-editing.MaxHistoryMessages:]
	}

	var gpt GPT
	if cloud {
		gpt = &CloudGPT{}
	} else {
		gpt = &OpenAIGPT{
			c:                   util.NewOpenAIClientWithModel(prov.APIKey, prov.BaseURL, m.Name),
			m:                   m,
			timeout:             prov.RequestTimeout,
			maxCompletionTokens: editing.MaxCompletionTokens,
			temperature:         editing.Temperature,
		}

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Use Settings - AI to set editing parameters (temperature, max tokens, history length) which initializes Conf.AI.Editing.
  2. If editing conf.json by hand, add an "editing" object with modelId, maxTokens, temperature, and maxHistoryMessages.
  3. After editing, restart the kernel so the config is reloaded and any defaults are applied.

Example fix

// before: conf.json "ai" has providers but no "editing"
{"ai": {"providers": [...]}}
// after
{"ai": {"providers": [...], "editing": {"modelId": "gpt-4o-mini", "maxTokens": 2048, "temperature": 0.7, "maxHistoryMessages": 7}}}
Defensive patterns

Strategy: validation

Validate before calling

if Conf.AI.Editing == nil {
    return errors.New("AI editing config missing; set editing model and parameters")
}

Type guard

func editingConfigReady(ai *conf.AI) bool { return ai.Editing != nil }

Prevention

When it happens

Trigger: Conf.AI.Editing is nil — typically from a hand-edited conf.json that omitted the "editing" object, a partial config import, or a downgrade/upgraded config that did not migrate the editing block.

Common situations: Editing conf.json directly and deleting/omitting the editing block; a config restore from an older backup predating the editing settings; a migration bug that leaves Editing nil despite providers being set.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/73bca98db80107ad. Report an issue: GitHub.