siyuan-note/siyuan · error

Conf.Language(332)

Error message

Conf.Language(332)

What it means

StartObsidianVaultImport rejects the call when the task is missing, its State is not ObsidianTaskStateReady, or its Context is nil — meaning the pre-import analysis has not completed successfully, so there is nothing to import from. i18n string 332 is "The Obsidian Vault analysis is not ready or has expired".

Solutions

  1. Wait for the analysis API to report state Ready before calling StartObsidianVaultImport
  2. Re-run the vault analysis to obtain a fresh, Ready taskID
  3. Poll the task state endpoint instead of assuming readiness after a fixed delay

Example fix

// before
await runObsidianImport(taskID); // may fire before analysis ready
// after
await waitForTaskState(taskID, 'ready');
await runObsidianImport(taskID);
Defensive patterns

Strategy: validation

Validate before calling

if (task.state !== 'ready' || !task.context) throw new Error('analysis not ready');
await runObsidianImport(task.taskID);

Try / catch

try { await runObsidianImport(taskID); } catch (e) { if (isAnalysisNotReady(e)) await rerunAnalysisAndImport(); else throw e; }

Prevention

When it happens

Trigger: Calling /api/import/runObsidianVaultImport with a taskID from an analysis that failed, is still running, was cancelled, or whose recorded Context was never populated.

Common situations: Calling import before the analysis promise resolved; reusing an ID from a failed analysis; kernel restart lost the in-memory task map.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/f5cd77ef79d2dad1. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/import_obsidian.go:312

		obsidianTasksMu.Unlock()
		return ret, errors.New(Conf.Language(331))
	}
	if task.Cancel != nil {
		task.Cancel()
	}
	finishObsidianTaskLocked(task, ObsidianTaskStateCancelled, "Import cancelled", "")
	ret := snapshotObsidianTask(task)
	obsidianTasksMu.Unlock()
	removeObsidianTemp(taskID)
	return ret, nil
}

func StartObsidianVaultImport(taskID, notebookName string) (*ObsidianVaultTask, error) {
	obsidianTasksMu.Lock()
	task := obsidianTasks[taskID]
	if task == nil || task.State != ObsidianTaskStateReady || task.Context == nil {
		obsidianTasksMu.Unlock()
		return nil, errors.New(Conf.Language(332))
	}
	if time.Now().After(task.ExpiresAt) {
		finishObsidianTaskLocked(task, ObsidianTaskStateCancelled, "Analysis expired", "")
		obsidianTasksMu.Unlock()
		return nil, errors.New(Conf.Language(332))
	}

	name := strings.TrimSpace(util.RemoveInvalid(notebookName))
	if name == "" {
		name = task.Analysis.NotebookName
	}
	ctx, cancel := context.WithCancel(context.Background())
	task.Cancel = cancel
	task.State = ObsidianTaskStateRevalidating
	task.Progress = 1
	task.Message = "Revalidating source files"
	ret := snapshotObsidianTask(task)
	obsidianTasksMu.Unlock()

View on GitHub (pinned to 9f775e8a12)