siyuan-note/siyuan · error

Conf.Language(77) {msg}

Error message

Conf.Language(77) {msg}

What it means

SetSyncProviderLocal calls filepath.Abs on the local sync endpoint; if that fails it returns fmt.Errorf(Conf.Language(77), msg) = 'Invalid dir path [<msg>]'. filepath.Abs failure is rare and usually means the path cannot be made absolute because the working directory cannot be determined or the path is malformed on the OS.

Source

Thrown at kernel/model/sync.go:613

	webdav.Password = strings.TrimSpace(webdav.Password)
	webdav.Timeout = util.NormalizeTimeout(webdav.Timeout)
	webdav.ConcurrentReqs = util.NormalizeConcurrentReqs(webdav.ConcurrentReqs, conf.ProviderWebDAV)

	Conf.Sync.WebDAV = webdav
	Conf.Save()
	refreshLANSyncManager()
	return
}

func SetSyncProviderLocal(local *conf.Local) (err error) {
	local.Endpoint = strings.TrimSpace(local.Endpoint)
	local.Endpoint = util.NormalizeLocalPath(local.Endpoint)

	absPath, err := filepath.Abs(local.Endpoint)
	if nil != err {
		msg := fmt.Sprintf("get endpoint [%s] abs path failed: %s", local.Endpoint, err)
		logging.LogError(msg)
		err = fmt.Errorf(Conf.Language(77), msg)
		return
	}
	if !gulu.File.IsExist(absPath) {
		msg := fmt.Sprintf("endpoint [%s] not exist", local.Endpoint)
		logging.LogError(msg)
		err = fmt.Errorf(Conf.Language(77), msg)
		return
	}
	if util.IsAbsPathInWorkspace(absPath) || filepath.Clean(absPath) == filepath.Clean(util.WorkspaceDir) {
		msg := fmt.Sprintf("endpoint [%s] is in workspace", local.Endpoint)
		logging.LogError(msg)
		err = fmt.Errorf(Conf.Language(77), msg)
		return
	}

	if gulu.File.IsSubPath(absPath, util.WorkspaceDir) {
		msg := fmt.Sprintf("endpoint [%s] is parent of workspace", local.Endpoint)
		logging.LogError(msg)

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Provide an absolute, OS-legal filesystem path as the Local endpoint.
  2. Remove illegal characters (NUL, control chars) from the path string.
  3. If the path is relative, resolve it yourself first and pass the absolute form.

Example fix

// before
local.Endpoint = "~/sync dir\\u0000" // -> error 77 (abs failed)
// after
abs, _ := filepath.Abs("~/sync dir")
local.Endpoint = abs
Defensive patterns

Strategy: validation

Validate before calling

// Go caller: pre-resolve and reject
abs, err := filepath.Abs(local.Endpoint)
if err != nil { return fmt.Errorf("invalid local path %q: %w", local.Endpoint, err) }

Type guard

// Go
func resolvableAbsPath(p string) bool {
    _, err := filepath.Abs(p)
    return err == nil
}

Prevention

When it happens

Trigger: POST /api/sync/setSyncProviderLocal with a Local endpoint that filepath.Abs cannot resolve (e.g. contains NUL bytes, or the process CWD is unavailable). The msg describes 'get endpoint [X] abs path failed: <os err>'.

Common situations: Path pasted from another OS with illegal characters. Relative path while the process CWD was changed/unlinked. Corrupted input from a config import.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/7fee6d1d0c917bbe. Report an issue: GitHub.