{"record":{"id":"295fa36cd8ec347b","repo":"chenhg5/cc-connect","slug":"claudecode-cannot-determine-home-dir-w","errorCode":null,"errorMessage":"claudecode: cannot determine home dir: %w","messagePattern":"claudecode: cannot determine home dir: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/claudecode/claudecode.go","lineNumber":562,"sourceCode":"\tplatformPrompt := a.platformPrompt\n\tsystemPrompt := a.systemPrompt\n\tappendSystemPrompt := a.appendSystemPrompt\n\t// Issue #1655: agent-level language drives the localized cc-connect system\n\t// prompt. Read under the mutex and pass through to newClaudeSession so the\n\t// session picks up the right tool-prompt bundle at spawn time.\n\tlang := a.lang\n\t// When router_url is set, --verbose conflicts with --output-format stream-json\n\t// (verbose emits non-JSON text to stdout that corrupts the JSON stream).\n\tdisableVerbose := a.routerURL != \"\"\n\ta.mu.Unlock()\n\n\treturn newClaudeSession(ctx, workDir, a.cmd, a.cliExtraArgs, a.cmdArgsFlag, model, effort, sessionID, mode, systemPrompt, appendSystemPrompt, tools, disTools, pluginDirs, extraEnv, platformPrompt, disableVerbose, a.spawnOpts, maxTok, a.ccDataDir, lang)\n}\n\nfunc (a *Agent) ListSessions(ctx context.Context) ([]core.AgentSessionInfo, error) {\n\thomeDir, err := os.UserHomeDir()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"claudecode: cannot determine home dir: %w\", err)\n\t}\n\n\ta.mu.RLock()\n\tworkDir := a.workDir\n\ta.mu.RUnlock()\n\tabsWorkDir, err := filepath.Abs(workDir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"claudecode: resolve work_dir: %w\", err)\n\t}\n\n\tprojectDir := findProjectDir(homeDir, absWorkDir)\n\tif projectDir == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tentries, err := os.ReadDir(projectDir)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/claudecode/claudecode.go#L544-L580","documentation":"Wraps a failed os.UserHomeDir() inside claudecode Agent.ListSessions. Claude Code stores project session files under ~/.claude/projects/...; without a home directory the storage path cannot be built, so listing aborts.","triggerScenarios":"Thrown at agent/claudecode/claudecode.go:562 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set HOME in the cc-connect daemon environment","Verify the user running cc-connect exists with a valid home","Retry /sessions after fixing the environment"],"exampleFix":null,"handlingStrategy":"try-catch","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"}