{"record":{"id":"f5cd77ef79d2dad1","repo":"siyuan-note/siyuan","slug":"conf-language-332","errorCode":null,"errorMessage":"Conf.Language(332)","messagePattern":"Conf\\.Language\\(332\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/import_obsidian.go","lineNumber":312,"sourceCode":"\t\tobsidianTasksMu.Unlock()\n\t\treturn ret, errors.New(Conf.Language(331))\n\t}\n\tif task.Cancel != nil {\n\t\ttask.Cancel()\n\t}\n\tfinishObsidianTaskLocked(task, ObsidianTaskStateCancelled, \"Import cancelled\", \"\")\n\tret := snapshotObsidianTask(task)\n\tobsidianTasksMu.Unlock()\n\tremoveObsidianTemp(taskID)\n\treturn ret, nil\n}\n\nfunc StartObsidianVaultImport(taskID, notebookName string) (*ObsidianVaultTask, error) {\n\tobsidianTasksMu.Lock()\n\ttask := obsidianTasks[taskID]\n\tif task == nil || task.State != ObsidianTaskStateReady || task.Context == nil {\n\t\tobsidianTasksMu.Unlock()\n\t\treturn nil, errors.New(Conf.Language(332))\n\t}\n\tif time.Now().After(task.ExpiresAt) {\n\t\tfinishObsidianTaskLocked(task, ObsidianTaskStateCancelled, \"Analysis expired\", \"\")\n\t\tobsidianTasksMu.Unlock()\n\t\treturn nil, errors.New(Conf.Language(332))\n\t}\n\n\tname := strings.TrimSpace(util.RemoveInvalid(notebookName))\n\tif name == \"\" {\n\t\tname = task.Analysis.NotebookName\n\t}\n\tctx, cancel := context.WithCancel(context.Background())\n\ttask.Cancel = cancel\n\ttask.State = ObsidianTaskStateRevalidating\n\ttask.Progress = 1\n\ttask.Message = \"Revalidating source files\"\n\tret := snapshotObsidianTask(task)\n\tobsidianTasksMu.Unlock()","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/import_obsidian.go#L294-L330","documentation":"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\".","triggerScenarios":"Calling /api/import/runObsidianVaultImport with a taskID from an analysis that failed, is still running, was cancelled, or whose recorded Context was never populated.","commonSituations":"Calling import before the analysis promise resolved; reusing an ID from a failed analysis; kernel restart lost the in-memory task map.","solutions":["Wait for the analysis API to report state Ready before calling StartObsidianVaultImport","Re-run the vault analysis to obtain a fresh, Ready taskID","Poll the task state endpoint instead of assuming readiness after a fixed delay"],"exampleFix":"// before\nawait runObsidianImport(taskID); // may fire before analysis ready\n// after\nawait waitForTaskState(taskID, 'ready');\nawait runObsidianImport(taskID);","handlingStrategy":"validation","validationCode":"if (task.state !== 'ready' || !task.context) throw new Error('analysis not ready');\nawait runObsidianImport(task.taskID);","typeGuard":null,"tryCatchPattern":"try { await runObsidianImport(taskID); } catch (e) { if (isAnalysisNotReady(e)) await rerunAnalysisAndImport(); else throw e; }","preventionTips":["Gate the Import button on the analysis state reaching Ready","Never reuse taskIDs across kernel restarts","Await the analysis promise fully before starting the import"],"tags":["obsidian","import","not-ready","task-state"],"backgroundTag":"invalid-state-transition","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"}