{"record":{"id":"49e8d711f38acf9d","repo":"siyuan-note/siyuan","slug":"conf-language-77","errorCode":null,"errorMessage":"Conf.Language(77)","messagePattern":"Conf\\.Language\\(77\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/sync.go","lineNumber":650,"sourceCode":"\t}\n\n\tConf.Sync.WebDAV = webdav\n\tConf.Save()\n\trefreshLANSyncManager()\n\treturn\n}\n\nfunc SetSyncProviderLocal(local *conf.Local) (err error) {\n\trelease := lockAssetSourceChange()\n\tdefer release()\n\tlocal.Endpoint = strings.TrimSpace(local.Endpoint)\n\tlocal.Endpoint = util.NormalizeLocalPath(local.Endpoint)\n\n\tabsPath, err := filepath.Abs(local.Endpoint)\n\tif nil != err {\n\t\tmsg := fmt.Sprintf(\"get endpoint [%s] abs path failed: %s\", local.Endpoint, err)\n\t\tlogging.LogError(msg)\n\t\terr = fmt.Errorf(Conf.Language(77), msg)\n\t\treturn\n\t}\n\tif !gulu.File.IsExist(absPath) {\n\t\tmsg := fmt.Sprintf(\"endpoint [%s] not exist\", local.Endpoint)\n\t\tlogging.LogError(msg)\n\t\terr = fmt.Errorf(Conf.Language(77), msg)\n\t\treturn\n\t}\n\tif util.IsAbsPathInWorkspace(absPath) || filepath.Clean(absPath) == filepath.Clean(util.WorkspaceDir) {\n\t\tmsg := fmt.Sprintf(\"endpoint [%s] is in workspace\", local.Endpoint)\n\t\tlogging.LogError(msg)\n\t\terr = fmt.Errorf(Conf.Language(77), msg)\n\t\treturn\n\t}\n\n\tif gulu.File.IsSubPath(absPath, util.WorkspaceDir) {\n\t\tmsg := fmt.Sprintf(\"endpoint [%s] is parent of workspace\", local.Endpoint)\n\t\tlogging.LogError(msg)","sourceCodeStart":632,"sourceCodeEnd":668,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/sync.go#L632-L668","documentation":"SetSyncProviderLocal configures the local filesystem as sync provider; the endpoint must resolve to an absolute path. If filepath.Abs fails on the normalized endpoint (typically because the path is malformed or the working directory is unusable), the kernel logs the detail and returns localized message 77 formatted with the diagnostic msg. The provider is not switched on failure.","triggerScenarios":"Calling /api/sync/setSyncProviderLocal with local.Endpoint that filepath.Abs cannot resolve — e.g. extremely long paths, paths with invalid characters on Windows, or an empty endpoint combined with a failed current-directory lookup.","commonSituations":"Passing an empty or whitespace-only endpoint whose normalization still yields something unresolvable; Windows paths with reserved characters (\"?\", \"*\", control chars); running in an environment where the process working directory was deleted.","solutions":["Supply a valid, existing local directory path as local.Endpoint (e.g. D:\\SiYuanSync or /home/user/siyuan-sync).","Normalize the path first (forward slashes on Windows, no relative fragments) and confirm it is well-formed.","Check kernel logs for the 'get endpoint ... abs path failed' line to see the underlying OS error."],"exampleFix":"// before\nlocal.Endpoint = \"D:\\\\sync?dir\" // invalid Windows path chars\n// after\nlocal.Endpoint = \"D:\\\\siyuan-sync\"\nmodel.SetSyncProviderLocal(local)","handlingStrategy":"validation","validationCode":"function canSetLocalEndpoint(endpoint) {\n  return typeof endpoint === \"string\" && endpoint.trim().length > 0 && !/[?*<>|]/.test(endpoint);\n}","typeGuard":null,"tryCatchPattern":"if err := model.SetSyncProviderLocal(local); err != nil {\n    // Language(77): surface the formatted detail; check logs for 'abs path failed'\n    return err\n}","preventionTips":["Ensure the endpoint is a well-formed path for the current OS","Avoid reserved/illegal filename characters, especially on Windows","Use absolute paths instead of relying on relative resolution"],"tags":["go","sync","local-provider","filesystem","path"],"backgroundTag":"invalid-argument-format","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}