siyuan-note/siyuan · error

import from local path failed, please check kernel log for d

Error message

import from local path failed, please check kernel log for details

What it means

Thrown by importFromLocalPath from a deferred recover() handler. The entire import function body is wrapped in a panic recovery block: if any panic occurs (nil pointer dereference, index out of range, type assertion failure, etc.), the panic value and full stack trace are logged via logging.LogErrorf, and a generic user-facing error is returned. The actual root cause is only visible in the kernel log, not in the returned error.

Source

Thrown at kernel/model/import.go:1208

func ImportFromLocalPathSkipRoot(boxID, localPath string, toPath string) (err error) {
	return importFromLocalPath(boxID, localPath, toPath, true)
}

func importFromLocalPath(boxID, localPath string, toPath string, skipRoot bool) (err error) {
	box, err := getOpenedBox(boxID)
	if nil != err {
		return err
	}
	toPath = normalizeBoxDocTarget(boxID, toPath)
	util.PushEndlessProgress(Conf.Language(73))
	defer func() {
		util.PushClearProgress()

		if e := recover(); nil != e {
			stack := debug.Stack()
			msg := fmt.Sprintf("PANIC RECOVERED: %v\n\t%s\n", e, stack)
			logging.LogErrorf("import from local path failed: %s", msg)
			err = errors.New("import from local path failed, please check kernel log for details")
		}
	}()

	lockSync()
	defer unlockSync()

	FlushTxQueue()

	var baseHPath, baseTargetPath string
	if "/" == toPath {
		baseHPath = "/"
		baseTargetPath = "/"
	} else {
		block := treenode.GetBlockTreeRootByPath(boxID, toPath)
		if nil == block {
			logging.LogErrorf("not found block by path [%s]", toPath)
			return nil
		}

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Check the kernel log for the PANIC RECOVERED entry — it includes the panic value and full stack trace pinpointing the exact failure.
  2. Try importing the file in smaller pieces to isolate which content triggers the panic.
  3. Test the file in a fresh SiYuan instance to rule out workspace-specific state issues.
  4. Report the panic with the stack trace and the problematic file content to the SiYuan issue tracker.
  5. Update SiYuan to the latest version — the panic may already be fixed.
Defensive patterns

Strategy: try-catch

Try / catch

// The function already has internal panic recovery.
// In the caller, detect the generic error and direct to logs:
err := model.ImportFromLocalPath(boxID, localPath, toPath)
if err != nil && strings.Contains(err.Error(), "check kernel log for details") {
    // A panic occurred — the detailed stack trace is in the kernel log
    logging.LogErrorf("import panicked — check previous log entries for PANIC RECOVERED and stack trace")
    // Report to user with guidance
}

Prevention

When it happens

Trigger: Calling importFromLocalPath (or ImportFromLocalPath / ImportFromLocalPathSkipRoot) where any code path in the function body panics. The recover at import.go:1204-1209 catches it and converts it to this error. Common panic sources include nil tree from parseStdMd, nil block from GetBlockTreeRootByPath, unexpected node types during AST traversal, or file parsing edge cases.

Common situations: Importing a corrupt or malformed Markdown file that triggers an unexpected code path. Importing a file with edge-case content (deeply nested HTML, unusual frontmatter, malformed Markdown syntax). Bug in the import logic that manifests only with specific content patterns. Version incompatibility where the parser expects a different tree structure.

Related errors


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