{"record":{"id":"a8639632f4504b92","repo":"multica-ai/multica","slug":"local-directory-local-path-is-empty","errorCode":null,"errorMessage":"local_directory: local_path is empty","messagePattern":"local_directory: local_path is empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/daemon/local_directory.go","lineNumber":165,"sourceCode":"\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmatch = &localDirectoryAssignment{\n\t\t\tRef:      ref,\n\t\t\tAbsPath:  absPath,\n\t\t\tRealPath: realPath,\n\t\t}\n\t}\n\treturn match, nil\n}\n\n// normalizeLocalPath strips whitespace and resolves the path to an absolute\n// cleaned form. It does NOT touch the filesystem (no symlink resolution, no\n// existence check) — callers do that separately via validateLocalPath.\nfunc normalizeLocalPath(p string) (string, error) {\n\ttrimmed := strings.TrimSpace(p)\n\tif trimmed == \"\" {\n\t\treturn \"\", errors.New(\"local_directory: local_path is empty\")\n\t}\n\tif !filepath.IsAbs(trimmed) {\n\t\treturn \"\", fmt.Errorf(\"local_directory: local_path must be absolute, got %q\", trimmed)\n\t}\n\treturn filepath.Clean(trimmed), nil\n}\n\n// resolveRealPath returns the symlink-resolved absolute form of path. The\n// path mutex keys on this value so a task on `/Users/u/proj` and another on\n// `/private/var/folders/.../proj-symlink → /Users/u/proj` collapse to one\n// lock. When EvalSymlinks fails (path is missing or not yet a real link),\n// fall back to the cleaned absolute form so callers can still proceed to\n// the existence-check stage which surfaces a clearer error.\nfunc resolveRealPath(absPath string) (string, error) {\n\treal, err := filepath.EvalSymlinks(absPath)\n\tif err != nil {\n\t\t// validateLocalPath will surface the underlying error with better\n\t\t// context; for the mutex key the cleaned absolute path is a safe","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/daemon/local_directory.go#L147-L183","documentation":"Returned by normalizeLocalPath in server/internal/daemon/local_directory.go when the local_directory runtime's local_path value is empty after trimming whitespace. The function is the first normalization step for local-directory task sources: it strips whitespace, requires an absolute path, and cleans it — an empty input can never resolve to a working directory, so it fails before any filesystem access (the function deliberately does no stat/symlink work).","triggerScenarios":"Creating a local_directory runtime/task with local_path set to \"\", \"   \", or a value that is only whitespace; a form or API client sending the field unset because it treated it as optional; JSON payload built with local_path: undefined serialized as empty.","commonSituations":"UI form submitted without filling the path field; automation scripts templating the path from an unset variable; whitespace-only paste from a clipboard.","solutions":["Provide a non-empty, absolute path for local_path (e.g. /Users/me/projects/app).","Validate the field in the UI/API client before submission: required, trimmed, and must start with '/'.","If the path comes from a variable in automation, assert it is set before issuing the request."],"exampleFix":"# before\n{\"source\": {\"type\": \"local_directory\", \"local_path\": \"\"}}\n\n# after\n{\"source\": {\"type\": \"local_directory\", \"local_path\": \"/home/me/code/proj\"}}","handlingStrategy":"validation","validationCode":"// Client-side, before creating a local_directory source\nconst path = String(localPath ?? \"\").trim();\nif (!path || !path.startsWith(\"/\")) {\n  setError(\"local_path is required and must be absolute\");\n  return;\n}","typeGuard":"function isValidLocalPathInput(p: unknown): boolean {\n  return typeof p === \"string\" && p.trim() !== \"\" && p.trim().startsWith(\"/\");\n}","tryCatchPattern":null,"preventionTips":["Make local_path a required, trimmed, absolute-path field in the UI form.","Reject empty/whitespace values at the API client before the request.","In automation, assert the path variable is non-empty before templating the payload."],"tags":["local-directory","validation","daemon","paths","go"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}