{"record":{"id":"3a9388ae6ed938fe","repo":"siyuan-note/siyuan","slug":"conf-language-37","errorCode":null,"errorMessage":"Conf.Language(37)","messagePattern":"Conf\\.Language\\(37\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/sync.go","lineNumber":537,"sourceCode":"\t\tif indexed {\n\t\t\tupsertRootIDs = append(upsertRootIDs, rootID)\n\t\t}\n\t}\n\n\tif 1 > len(upsertRootIDs) {\n\t\tupsertRootIDs = []string{}\n\t}\n\treturn\n}\n\nfunc SetCloudSyncDir(name string) error {\n\trelease := lockAssetSourceChange()\n\tdefer release()\n\tif conf.ProviderS3 == Conf.Sync.Provider {\n\t\treturn errors.New(Conf.Language(131))\n\t}\n\tif !cloud.IsValidCloudDirName(name) {\n\t\treturn errors.New(Conf.Language(37))\n\t}\n\n\tif Conf.Sync.CloudName == name {\n\t\treturn nil\n\t}\n\tif err := requireCompleteAssetDownloads(); err != nil {\n\t\treturn err\n\t}\n\n\tConf.Sync.CloudName = name\n\tConf.Save()\n\trefreshLANSyncManager()\n\treturn nil\n}\n\nfunc SetSyncGenerateConflictDoc(b bool) {\n\tConf.Sync.GenerateConflictDoc = b\n\tConf.Save()","sourceCodeStart":519,"sourceCodeEnd":555,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/sync.go#L519-L555","documentation":"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.","triggerScenarios":"Calling SetCloudSyncDir with a name that is empty, longer than 63 chars, or containing spaces/special symbols so IsValidCloudDirName returns false.","commonSituations":"User typed a directory name with spaces or Chinese/special characters; name pasted from elsewhere exceeding 63 chars; scripted call passing an empty string.","solutions":["Provide a name of 1-63 characters using only letters, digits, and hyphens (bucket-style naming)","Trim whitespace and re-check the name in the UI before submitting","Validate client-side with a regex equivalent to IsValidCloudDirName before calling the API"],"exampleFix":"// before\nmodel.SetCloudSyncDir(\"My Sync Dir!\")\n// after\nname := \"my-sync-dir\" // 1-63 chars, no spaces/special symbols\nmodel.SetCloudSyncDir(name)","handlingStrategy":"validation","validationCode":"const valid = /^[A-Za-z0-9][A-Za-z0-9-]{0,62}$/.test(name);\nif (!valid) { alert(\"1-63 chars, letters/digits/hyphens, no spaces\"); return; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate directory names against bucket rules (<=63 chars, no spaces/special symbols) in the UI","Trim user input before submitting","Reuse cloud.IsValidCloudDirName semantics in any scripted callers"],"tags":["go","sync","validation","bucket-name"],"backgroundTag":"invalid-argument-format","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}