siyuan-note/siyuan · error

directory assets are not supported in encrypted notebooks

Error message

directory assets are not supported in encrypted notebooks

What it means

In the Upload handler, when files are uploaded with the unzip-to-directory flag (needUnzip2Dir, e.g. .zip/.rtfd bundles), the target notebook must not be an encrypted notebook. Encrypted notebooks cannot store a directory of extracted assets, so the upload of that file is recorded as a failure with "directory assets are not supported in encrypted notebooks" and skipped.

Source

Thrown at kernel/model/upload.go:366

		if gulu.OS.IsDarwin() {
			if strings.HasSuffix(baseName, ".rtfd.zip") {
				needUnzip2Dir = true
			}
		}

		fName := baseName
		fName = util.FilterUploadFileName(fName)
		ext := filepath.Ext(fName)
		fName = strings.TrimSuffix(fName, ext)
		ext = strings.ToLower(ext)
		fName += ext
		f, openErr := file.Open()
		if nil != openErr {
			recordFailure(index, file.Filename, fName, openErr)
			continue
		}
		if needUnzip2Dir && IsEncryptedBox(uploadBoxID) {
			unsupportedErr := errors.New("directory assets are not supported in encrypted notebooks")
			recordFailure(index, file.Filename, fName, unsupportedErr)
			f.Close()
			continue
		}

		hash, hashErr := util.GetEtagByHandle(f, file.Size)
		if nil != hashErr {
			recordFailure(index, file.Filename, fName, hashErr)
			f.Close()
			continue
		}

		if 1 > file.Size {
			hash = "random_1_" + gulu.Rand.String(12)
		}

		existAssetPath := GetAssetPathByHash(hash, uploadBoxID)
		if "" != existAssetPath {

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Upload such assets to a non-encrypted notebook instead.
  2. Convert the directory asset to single flat files (e.g. export RTFD contents as individual images) and upload those individually.
  3. Disable encryption for the notebook if directory asset support there is required (weighing the loss of encryption).

Example fix

// before
uploadMultipart(targetDocID, "note.rtfd") // encrypted box -> failure
// after
for _, img := range extractRTFDImages("note.rtfd") {
    uploadMultipart(targetDocID, img) // plain files are supported
}
Defensive patterns

Strategy: fallback

Validate before calling

if model.IsEncryptedBox(boxID) && needUnzip2Dir {
    return fmt.Errorf("directory assets are not supported in encrypted notebooks; upload plain files instead")
}

Try / catch

result, err := model.Upload(...) // inspect per-file failures
for _, f := range result.FailedFiles {
    if strings.Contains(f.Error, "not supported in encrypted notebooks") {
        for _, flat := range flattenDirectoryAsset(f.Name) {
            uploadSingleFile(boxID, flat) // fallback: upload plain files
        }
    }
}

Prevention

When it happens

Trigger: Calling the asset upload API (Upload) against a document in an encrypted notebook while uploading an archive/dir-type asset that triggers needUnzip2Dir (e.g. .rtfd or .zip directory assets).

Common situations: Dragging an Apple RTFD bundle into the editor while the target notebook is encrypted; automation scripts uploading directory-style assets to an encrypted box.

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/3b65971d5de624fe. Report an issue: GitHub.