{"record":{"id":"459cab3125ac3389","repo":"chenhg5/cc-connect","slug":"resolve-home-directory-w-459cab","errorCode":null,"errorMessage":"resolve home directory: %w","messagePattern":"resolve home directory: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/engine.go","lineNumber":11487,"sourceCode":"\t}\n\tif strings.TrimSpace(e.baseWorkDir) != \"\" {\n\t\treturn strings.TrimSpace(e.baseWorkDir)\n\t}\n\tif cwd, err := os.Getwd(); err == nil {\n\t\treturn cwd\n\t}\n\treturn \"\"\n}\n\nfunc normalizeSendWorkDir(workDir, base string) (string, error) {\n\tdir := strings.TrimSpace(workDir)\n\tif dir == \"\" {\n\t\treturn \"\", fmt.Errorf(\"work_dir is required\")\n\t}\n\tif dir == \"~\" || strings.HasPrefix(dir, \"~/\") {\n\t\thome, err := os.UserHomeDir()\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"resolve home directory: %w\", err)\n\t\t}\n\t\tif dir == \"~\" {\n\t\t\tdir = home\n\t\t} else {\n\t\t\tdir = filepath.Join(home, strings.TrimPrefix(dir, \"~/\"))\n\t\t}\n\t}\n\tif !filepath.IsAbs(dir) {\n\t\tif strings.TrimSpace(base) == \"\" {\n\t\t\tvar err error\n\t\t\tbase, err = os.Getwd()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"resolve current directory: %w\", err)\n\t\t\t}\n\t\t}\n\t\tdir = filepath.Join(base, dir)\n\t}\n\tabs, err := filepath.Abs(filepath.Clean(dir))","sourceCodeStart":11469,"sourceCodeEnd":11505,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/engine.go#L11469-L11505","documentation":"normalizeSendWorkDir wraps os.UserHomeDir failure while expanding a '~'-prefixed work_dir (home directory undeterminable, e.g. HOME unset for the daemon user). The path cannot be resolved, so the send is refused.","triggerScenarios":"Thrown at core/engine.go:11487 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set $HOME properly for the daemon process","Use an absolute path instead of ~/ in work_dir"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}