siyuan-note/siyuan · error

Conf.Language(330)

Error message

Conf.Language(330)

What it means

`GetObsidianVaultTask` looks up `obsidianTasks[taskID]`; when the ID matches no known task (including already-expunged/finished tasks removed from the map), it returns the localized "task not found" message at i18n key 330. The in-memory task map only lives for the current kernel session.

Solutions

  1. Use the exact task ID returned by the `ImportObsidianVault` call that created the task
  2. If the kernel was restarted, re-submit the import to get a fresh task ID — old IDs are gone
  3. Treat this as terminal in the poller: stop polling instead of retrying the same ID

Example fix

// before
GetObsidianVaultTask("old-id-after-restart") // -> errors.New(Conf.Language(330))
// after
task, err := ImportObsidianVault(vaultPath) // fresh task with new TaskID
GetObsidianVaultTask(task.TaskID)
Defensive patterns

Strategy: try-catch

Validate before calling

function hasTaskId(t: unknown): t is { taskId: string } {
  return typeof t === "object" && t !== null && typeof (t as { taskId?: unknown }).taskId === "string" && (t as { taskId: string }).taskId.length > 0;
}

Type guard

function hasTaskId(t: unknown): t is { taskId: string } {
  return typeof t === "object" && t !== null && typeof (t as { taskId?: unknown }).taskId === "string";
}

Try / catch

try {
  const task = await api.getObsidianVaultTask(taskId);
} catch (e) {
  if (isTaskNotFound(e)) {
    // stop polling; obtain a new task ID by re-submitting the import
  }
}

Prevention

When it happens

Trigger: Calling `GetObsidianVaultTask` (or `CancelObsidianVaultTask`) with a taskID that was never created, a typo'd ID, or an ID from a previous kernel restart — the map is memory-only.

Common situations: Frontend kept a stale task ID after a kernel restart; polling continued after the task finished and was cleaned from the map; two clients racing where one cancelled/cleared the task.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/import_obsidian.go:280

	task := &obsidianTask{TaskID: taskID, State: ObsidianTaskStateQueued, Message: "Waiting to analyze", Cancel: cancel}
	obsidianTasks[taskID] = task
	obsidianActive = taskID
	ret := snapshotObsidianTask(task)
	obsidianTasksMu.Unlock()

	if replacedTaskID != "" {
		removeObsidianTemp(replacedTaskID)
	}
	go analyzeObsidianVaultTask(ctx, taskID, localPath)
	return ret, nil
}

func GetObsidianVaultTask(taskID string) (*ObsidianVaultTask, error) {
	obsidianTasksMu.Lock()
	defer obsidianTasksMu.Unlock()
	task := obsidianTasks[taskID]
	if task == nil {
		return nil, errors.New(Conf.Language(330))
	}
	return snapshotObsidianTask(task), nil
}

func CancelObsidianVaultTask(taskID string) (*ObsidianVaultTask, error) {
	obsidianTasksMu.Lock()
	task := obsidianTasks[taskID]
	if task == nil {
		obsidianTasksMu.Unlock()
		return nil, errors.New(Conf.Language(330))
	}
	if !isObsidianCancellableState(task.State) {
		ret := snapshotObsidianTask(task)
		obsidianTasksMu.Unlock()
		return ret, errors.New(Conf.Language(331))
	}
	if task.Cancel != nil {
		task.Cancel()

View on GitHub (pinned to 9f775e8a12)