siyuan-note/siyuan · error

Conf.Language(37)

Error message

Conf.Language(37)

What it means

SetCloudSyncDir validates the requested directory name with cloud.IsValidCloudDirName; on failure it returns the localized message for key 37: the cloud sync directory name (Bucket) cannot be empty, contain spaces or special symbols, and is limited to 63 characters. This enforces S3-compatible bucket naming rules for the sync directory.

Solutions

  1. Provide a name of 1-63 characters using only letters, digits, and hyphens (bucket-style naming)
  2. Trim whitespace and re-check the name in the UI before submitting
  3. Validate client-side with a regex equivalent to IsValidCloudDirName before calling the API

Example fix

// before
model.SetCloudSyncDir("My Sync Dir!")
// after
name := "my-sync-dir" // 1-63 chars, no spaces/special symbols
model.SetCloudSyncDir(name)
Defensive patterns

Strategy: validation

Validate before calling

const valid = /^[A-Za-z0-9][A-Za-z0-9-]{0,62}$/.test(name);
if (!valid) { alert("1-63 chars, letters/digits/hyphens, no spaces"); return; }

Prevention

When it happens

Trigger: Calling SetCloudSyncDir with a name that is empty, longer than 63 chars, or containing spaces/special symbols so IsValidCloudDirName returns false.

Common situations: User typed a directory name with spaces or Chinese/special characters; name pasted from elsewhere exceeding 63 chars; scripted call passing an empty string.

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


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/3a9388ae6ed938fe. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/sync.go:537

		if indexed {
			upsertRootIDs = append(upsertRootIDs, rootID)
		}
	}

	if 1 > len(upsertRootIDs) {
		upsertRootIDs = []string{}
	}
	return
}

func SetCloudSyncDir(name string) error {
	release := lockAssetSourceChange()
	defer release()
	if conf.ProviderS3 == Conf.Sync.Provider {
		return errors.New(Conf.Language(131))
	}
	if !cloud.IsValidCloudDirName(name) {
		return errors.New(Conf.Language(37))
	}

	if Conf.Sync.CloudName == name {
		return nil
	}
	if err := requireCompleteAssetDownloads(); err != nil {
		return err
	}

	Conf.Sync.CloudName = name
	Conf.Save()
	refreshLANSyncManager()
	return nil
}

func SetSyncGenerateConflictDoc(b bool) {
	Conf.Sync.GenerateConflictDoc = b
	Conf.Save()

View on GitHub (pinned to 9f775e8a12)