siyuan-note/siyuan · error

unsupported export path

Error message

unsupported export path

What it means

AcquireExportArtifactLease only supports acquiring a mobile export lease for paths that begin with "assets/" (or managed export paths / temp-dir export file names handled earlier in the function). Any other exportPath form — notebooks, documents, arbitrary paths — is rejected with this error because the lease mechanism only knows how to resolve and materialize asset artifacts. The check runs after managed-path and temp-export-file handling, so it is the final gate for path kinds.

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 8641553a1f)

Solutions

  1. Ensure the exportPath argument is an asset reference of the form "assets/<file>" (optionally scoped to an encrypted box) before calling AcquireExportArtifactLease.
  2. If you intend to export a document or notebook, use the dedicated document/notebook export APIs instead of the asset lease API.
  3. For a plain temp-export artifact, pass only the base file name (which is resolved under temp/export) rather than a full path.

Example fix

// before
lease, err := model.AcquireExportArtifactLease("20210808180117-czj9bvb/20210915210115-0b2ldga.sy")
// after
lease, err := model.AcquireExportArtifactLease("assets/foo.png")
Defensive patterns

Strategy: validation

Validate before calling

if !strings.HasPrefix(exportPath, "assets/") {
    return fmt.Errorf("lease requires an assets/ path, got %q", exportPath)
}

Prevention

When it happens

Trigger: Calling AcquireExportArtifactLease (directly or via materializeExportArtifact / AcquireMobileExportLease) with an exportPath that is not a managed encrypted export name, not a bare file name under temp/export, and does not start with "assets/" — e.g. passing a document ID, a notebook path like "20210808180117-czj9bvb/20210915210115-0b2ldga", or an absolute path.

Common situations: Plugin or client code assumes the lease API accepts any exportable block and passes a doc/notebook path; a caller passes an already-resolved absolute path instead of the "assets/..." form; older API payloads that used different path conventions are replayed against the new lease endpoint.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/a634c7977a305b6a. Report an issue: GitHub.