{"record":{"id":"ad6410b9f8427a04","repo":"siyuan-note/siyuan","slug":"conf-language-330","errorCode":null,"errorMessage":"Conf.Language(330)","messagePattern":"Conf\\.Language\\(330\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/import_obsidian.go","lineNumber":280,"sourceCode":"\ttask := &obsidianTask{TaskID: taskID, State: ObsidianTaskStateQueued, Message: \"Waiting to analyze\", Cancel: cancel}\n\tobsidianTasks[taskID] = task\n\tobsidianActive = taskID\n\tret := snapshotObsidianTask(task)\n\tobsidianTasksMu.Unlock()\n\n\tif replacedTaskID != \"\" {\n\t\tremoveObsidianTemp(replacedTaskID)\n\t}\n\tgo analyzeObsidianVaultTask(ctx, taskID, localPath)\n\treturn ret, nil\n}\n\nfunc GetObsidianVaultTask(taskID string) (*ObsidianVaultTask, error) {\n\tobsidianTasksMu.Lock()\n\tdefer obsidianTasksMu.Unlock()\n\ttask := obsidianTasks[taskID]\n\tif task == nil {\n\t\treturn nil, errors.New(Conf.Language(330))\n\t}\n\treturn snapshotObsidianTask(task), nil\n}\n\nfunc CancelObsidianVaultTask(taskID string) (*ObsidianVaultTask, error) {\n\tobsidianTasksMu.Lock()\n\ttask := obsidianTasks[taskID]\n\tif task == nil {\n\t\tobsidianTasksMu.Unlock()\n\t\treturn nil, errors.New(Conf.Language(330))\n\t}\n\tif !isObsidianCancellableState(task.State) {\n\t\tret := snapshotObsidianTask(task)\n\t\tobsidianTasksMu.Unlock()\n\t\treturn ret, errors.New(Conf.Language(331))\n\t}\n\tif task.Cancel != nil {\n\t\ttask.Cancel()","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/import_obsidian.go#L262-L298","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use the exact task ID returned by the `ImportObsidianVault` call that created the task","If the kernel was restarted, re-submit the import to get a fresh task ID — old IDs are gone","Treat this as terminal in the poller: stop polling instead of retrying the same ID"],"exampleFix":"// before\nGetObsidianVaultTask(\"old-id-after-restart\") // -> errors.New(Conf.Language(330))\n// after\ntask, err := ImportObsidianVault(vaultPath) // fresh task with new TaskID\nGetObsidianVaultTask(task.TaskID)","handlingStrategy":"try-catch","validationCode":"function hasTaskId(t: unknown): t is { taskId: string } {\n  return typeof t === \"object\" && t !== null && typeof (t as { taskId?: unknown }).taskId === \"string\" && (t as { taskId: string }).taskId.length > 0;\n}","typeGuard":"function hasTaskId(t: unknown): t is { taskId: string } {\n  return typeof t === \"object\" && t !== null && typeof (t as { taskId?: unknown }).taskId === \"string\";\n}","tryCatchPattern":"try {\n  const task = await api.getObsidianVaultTask(taskId);\n} catch (e) {\n  if (isTaskNotFound(e)) {\n    // stop polling; obtain a new task ID by re-submitting the import\n  }\n}","preventionTips":["Persist the task ID only from the response of the import call that created it","Clear cached task IDs after a kernel restart — tasks are memory-only","Stop polling once the task reaches a terminal state instead of probing stale IDs"],"tags":["obsidian","import","task-not-found","state"],"backgroundTag":"record-not-found","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}