{"record":{"id":"38d0103849bd130c","repo":"siyuan-note/siyuan","slug":"backup-failed-s","errorCode":null,"errorMessage":"Backup failed: %s","messagePattern":"Backup failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/repository.go","lineNumber":1485,"sourceCode":"\t\t\tutil.PushErrMsg(Conf.Language(29), 5000)\n\t\t\treturn\n\t\t}\n\tcase conf.ProviderWebDAV, conf.ProviderS3, conf.ProviderLocal:\n\t\tif !IsPaidUser() {\n\t\t\tutil.PushErrMsg(Conf.Language(214), 5000)\n\t\t\treturn\n\t\t}\n\t}\n\n\tutil.PushEndlessProgress(Conf.Language(116))\n\tdefer util.PushClearProgress()\n\tuploadFileCount, uploadChunkCount, uploadBytes, err := repo.UploadTagIndex(tag, id, map[string]any{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBarAndProgress})\n\tif err != nil {\n\t\tif errors.Is(err, dejavu.ErrCloudBackupCountExceeded) {\n\t\t\terr = fmt.Errorf(Conf.Language(84), Conf.Language(154))\n\t\t\treturn\n\t\t}\n\t\terr = fmt.Errorf(Conf.Language(84), formatRepoErrorMsg(err))\n\t\treturn\n\t}\n\tmsg := fmt.Sprintf(Conf.Language(152), uploadFileCount, uploadChunkCount, humanize.BytesCustomCeil(uint64(uploadBytes), 2))\n\tutil.PushMsg(msg, 5000)\n\tutil.PushStatusBar(msg)\n\treturn\n}\n\nfunc RemoveCloudRepoTag(tag string) (err error) {\n\tif 1 > len(Conf.Repo.Key) {\n\t\terr = errors.New(Conf.Language(26))\n\t\treturn\n\t}\n\n\trepo, err := newRepository()\n\tif err != nil {\n\t\treturn\n\t}","sourceCodeStart":1467,"sourceCodeEnd":1503,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/repository.go#L1467-L1503","documentation":"A generic catch-all for any UploadTagIndex failure that is NOT the 12-snapshot quota exceeded error. The raw dejavu error is passed through formatRepoErrorMsg to sanitize it, then wrapped in the 'Backup failed: %s' template (Language 84). Common underlying causes include network timeouts, authentication failures, encryption key mismatches, corrupted local index, or insufficient cloud storage.","triggerScenarios":"Calling UploadCloudSnapshot when the underlying repo.UploadTagIndex returns an error other than ErrCloudBackupCountExceeded. This covers network failures to the cloud endpoint, expired or invalid auth tokens, disk I/O errors reading local snapshot data, encryption/decryption failures, or cloud storage quota exhaustion.","commonSituations":"Intermittent network connectivity to WebDAV/S3/SiYuan cloud servers, expired login sessions (token rotation), mismatched encryption keys after a manual key reset, or local filesystem corruption in the repo directory. Also seen when the cloud storage provider has its own quota separate from the 12-snapshot limit.","solutions":["Check network connectivity to the cloud provider endpoint and retry the upload","Verify the cloud sync provider credentials in Settings - Account & Sync are still valid (re-login if using SiYuan cloud)","Inspect the kernel log for the detailed formatRepoErrorMsg output to identify the specific underlying cause","If the error persists, check whether Conf.Repo.Key matches the key used to create existing cloud snapshots (a key reset will make old data inaccessible)","Verify cloud storage quota has not been exceeded on the provider side"],"exampleFix":"// before\nerr = model.UploadCloudSnapshot(tag, id)\nif err != nil {\n    fmt.Println(err)\n}\n\n// after\nerr = model.UploadCloudSnapshot(tag, id)\nif err != nil {\n    // inspect kernel log for formatRepoErrorMsg detail\n    logging.LogErrorf(\"upload failed: %s\", err)\n    if errors.Is(err, dejavu.ErrCloudBackupCountExceeded) {\n        // handle quota case\n    }\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Retry transient upload failures with exponential backoff\nmaxRetries := 3\nfor i := 0; i < maxRetries; i++ {\n    err = model.UploadCloudSnapshot(tag, id)\n    if err == nil {\n        break\n    }\n    if errors.Is(err, dejavu.ErrCloudBackupCountExceeded) {\n        break // do not retry quota errors\n    }\n    time.Sleep(time.Duration(i+1) * 2 * time.Second)\n}","preventionTips":["Implement retry logic for transient network errors (timeouts, connection resets)","Do NOT retry ErrCloudBackupCountExceeded — it is a permanent quota error","Log the detailed error from formatRepoErrorMsg for diagnostics before surfacing to the user"],"tags":["cloud","backup","network","dejavu"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}