siyuan-note/siyuan · error
unsupported export path
Error message
unsupported export path
What it means
AcquireExportArtifactLease only accepts two path shapes: "/export/<name>" (temp export artifacts) and "assets/<path>" (notebook assets). Any other prefix — empty string, "/", "temp/", a full URL, an absolute filesystem path — is rejected up front because no lease can be issued for it. The assets/ branch then additionally requires the asset to belong to an encrypted box (otherwise it is resolved as a plain asset).
Solutions
- Normalize the input to one of the two supported forms: "/export/<relative-name>" or "assets/<relative-path>" before calling
- If you have an absolute temp path, convert it to "/export/" + relative portion; if you have a URL, extract only the path component and drop the scheme/host
- For assets, keep the exact "assets/" prefix (lowercase, no leading slash) as produced by assetPathAndBox-compatible paths
- Log the exact exportPath argument; a mismatch is almost always a slash/scheme normalization bug at the call site
Example fix
// before
lease, err := model.AcquireExportArtifactLease("/tmp/siyuan/export/doc.pdf")
// after
rel, _ := filepath.Rel(util.TempDir, p)
lease, err := model.AcquireExportArtifactLease("/export/" + filepath.ToSlash(rel)) Defensive patterns
Strategy: validation
Validate before calling
function isSupportedLeasePath(p) {
return typeof p === "string" &&
(p.startsWith("/export/") || p.startsWith("assets/"));
} Try / catch
if (!isSupportedLeasePath(exportPath)) {
exportPath = normalizeToLeasePath(exportPath); // map URLs/abs paths to "/export/.." or "assets/.."
}
try {
lease = await acquireExportArtifactLease(exportPath);
} catch (e) {
if (String(e).includes("unsupported export path")) throw new Error(`Bad lease path: ${exportPath}`);
throw e;
} Prevention
- Keep a single helper that produces lease paths so all call sites use "/export/..." or "assets/..." consistently
- Strip scheme/host from URLs and convert absolute temp paths to relative before calling
- Watch slash handling: "assets/" (no leading slash) vs "/export/" (leading slash) — the two forms differ
- Assert path shape in tests for any new caller of AcquireExportArtifactLease
When it happens
Trigger: AcquireExportArtifactLease (via materializeExportArtifact or AcquireMobileExportLease) called with a path that neither starts with "/export/" nor "assets/" — e.g. "", "/assets/x", "assets" (no trailing slash content is fine, but "export/foo" or "temp/export/foo" is not), a full "http://host/export/.." URL, or an OS absolute path.
Common situations: Caller passing an absolute server URL instead of the kernel-relative path; stripping or doubling the leading slash so "/assets/..." no longer matches; using the temp-dir filesystem path ("/tmp/siyuan/export/x.pdf") instead of the "/export/x.pdf" form; plugin/mobile code written against an older path convention.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Conf.Language(16)
- export artifact [ ] is a directory
- export path is outside export directory
- Field [ ] is required
- Field [ ] must not be empty
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/a634c7977a305b6a.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/encrypted_export.go:225
}
if _, dekErr := GetDEKIfUnlocked(boxID); dekErr != nil {
return nil, dekErr
}
lease, err = registerMobileExportLease(boxID, artifact, filepath.Base(fileName), "")
if err == nil {
release = false
}
return
}
artifact := filepath.Join(util.TempDir, "export", fileName)
if !gulu.File.IsSubPath(filepath.Join(util.TempDir, "export"), artifact) {
return nil, errors.New("export path is outside export directory")
}
return registerMobileExportLease("", artifact, filepath.Base(fileName), "")
}
if !strings.HasPrefix(exportPath, "assets/") {
return nil, errors.New("unsupported export path")
}
relativePath, boxID, parseErr := assetPathAndBox(exportPath, "")
if parseErr != nil {
return nil, parseErr
}
if boxID == "" || !IsEncryptedBox(boxID) {
artifact, resolveErr := GetAssetAbsPath(relativePath)
if resolveErr != nil {
return nil, resolveErr
}
if ensureErr := EnsureAssetLocal(artifact); ensureErr != nil {
return nil, ensureErr
}
return registerMobileExportLease("", artifact, filepath.Base(artifact), "")
}
if !IsBoxUnlocked(boxID) {
return nil, errors.New(Conf.Language(314))
}View on GitHub (pinned to 9f775e8a12)