siyuan-note/siyuan · error
managed export is unavailable
Error message
managed export is unavailable
What it means
When the export path's first segment looks like a notebook ID (IsManagedEncryptedExportPath), the path is treated as a managed encrypted-export artifact of the form <boxID>/<kind>/<file>. ResolveManagedEncryptedExport looks the path up in the managed export registry; if no registered artifact matches, the lease cannot be issued and this error is returned. It deliberately fails closed even after a notebook was deleted, so no plaintext artifact is exposed.
Solutions
- Re-run the export operation to re-register the managed artifact, then acquire a lease on the fresh path
- Verify the exact <boxID>/<kind>/<file> path matches what the export step returned (names are registry keys, not free-form)
- If the notebook was deleted or the kernel restarted, treat the old export URL as permanently invalid and regenerate it
- Check ResolveManagedEncryptedExport / the registry for expiry cleanup timing if downloads are happening long after export
Example fix
// before
lease, err := model.AcquireExportArtifactLease(staleExportURL) // registry entry gone
// after
artifact, err := exportDocToManagedArtifact(boxID, docID) // re-register
if err != nil { return err }
lease, err := model.AcquireExportArtifactLease("/export/" + artifact.RelativePath) Defensive patterns
Strategy: fallback
Validate before calling
// before downloading, confirm the managed artifact is still registered
const ok = await fetchPost("/api/encrypt/resolveManagedExport", { path: managedPath });
if (!ok.resolved) { await reExport(boxId, docId); } Try / catch
try {
lease = await acquireExportArtifactLease(managedPath);
} catch (e) {
if (String(e).includes("managed export is unavailable")) {
const fresh = await reExport(boxId, docId); // regenerate registry entry
lease = await acquireExportArtifactLease(fresh.path);
} else { throw e; }
} Prevention
- Download managed exports promptly; registry entries are volatile (expiry sweeps, restarts)
- Re-export rather than reusing export URLs cached from a previous session
- Never build managed paths by hand; use the path string returned by the export API verbatim
- Check for notebook deletion before attempting to download its exports
When it happens
Trigger: AcquireExportArtifactLease is called with "/export/<boxID>/<kind>/<name>" where boxID matches the node-ID pattern but ResolveManagedEncryptedExport returns resolved=false — e.g. the export lease/artifact was never registered, expired and was swept, or the notebook was deleted.
Common situations: Mobile client retries an export download after the managed artifact expired; accessing an export URL from a notebook deleted between export and download; typo'd or stale artifact name; kernel restart clearing the in-memory registry while a client still holds the old URL.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- encrypted document history has no matching notebook
- exporting encrypted and normal notebook resources together…
- exporting non-asset files from encrypted notebooks is not…
- exporting resources across encrypted notebook boundaries is…
- 314
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/2ac72ee36965310b.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/encrypted_export.go:191
}
return filepath.FromSlash(strings.Join(parts, "/"))
}
// AcquireExportArtifactLease 为导出产物取得覆盖整个复制过程的生命周期租约。
func AcquireExportArtifactLease(exportPath string) (lease *ExportArtifactLease, err error) {
if after, ok := strings.CutPrefix(exportPath, "/export/"); ok {
fileName, decodeErr := url.PathUnescape(after)
if decodeErr != nil {
return nil, decodeErr
}
fileName = filepath.Clean(fileName)
if fileName == "." || strings.HasPrefix(fileName, "..") || filepath.IsAbs(fileName) {
return nil, errors.New("invalid export path")
}
if IsManagedEncryptedExportPath(fileName) {
boxID, artifact, resolved := ResolveManagedEncryptedExport(fileName)
if !resolved {
return nil, errors.New("managed export is unavailable")
}
if err = AcquireEncryptedBoxOperation(boxID); err != nil {
return nil, err
}
HoldBoxReadLock(boxID)
release := true
defer func() {
if release {
ReleaseBoxReadLock(boxID)
ReleaseEncryptedBoxOperation(boxID)
}
}()
_, artifact, resolved = ResolveManagedEncryptedExport(fileName)
if !resolved {
return nil, errors.New("managed export is unavailable")
}
if _, dekErr := GetDEKIfUnlocked(boxID); dekErr != nil {
return nil, dekErrView on GitHub (pinned to 9f775e8a12)