chenhg5/cc-connect · error
claudecode: resolve work_dir: %w
Error message
claudecode: resolve work_dir: %w
What it means
Wraps a failed filepath.Abs on the agent's configured work directory during claudecode ListSessions. It fires when the working directory path cannot be made absolute — in practice when the process cwd has been deleted, since Abs rarely fails otherwise.
Source
Thrown at agent/claudecode/claudecode.go:570
// (verbose emits non-JSON text to stdout that corrupts the JSON stream).
disableVerbose := a.routerURL != ""
a.mu.Unlock()
return 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)
}
func (a *Agent) ListSessions(ctx context.Context) ([]core.AgentSessionInfo, error) {
homeDir, err := os.UserHomeDir()
if err != nil {
return nil, fmt.Errorf("claudecode: cannot determine home dir: %w", err)
}
a.mu.RLock()
workDir := a.workDir
a.mu.RUnlock()
absWorkDir, err := filepath.Abs(workDir)
if err != nil {
return nil, fmt.Errorf("claudecode: resolve work_dir: %w", err)
}
projectDir := findProjectDir(homeDir, absWorkDir)
if projectDir == "" {
return nil, nil
}
entries, err := os.ReadDir(projectDir)
if err != nil {
if os.IsNotExist(err) {
return nil, nil
}
return nil, fmt.Errorf("claudecode: read project dir: %w", err)
}
var sessions []core.AgentSessionInfo
for _, entry := range entries {
name := entry.Name()View on GitHub (pinned to 4000b2338a)
Solutions
- Ensure the configured work_dir still exists on disk
- Restart cc-connect from a valid directory if its cwd was removed
- Fix the work_dir path in config.toml
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at agent/claudecode/claudecode.go:570 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/2688baeef47043f0.
Report an issue: GitHub.