{"record":{"id":"2688baeef47043f0","repo":"chenhg5/cc-connect","slug":"claudecode-resolve-work-dir-w","errorCode":null,"errorMessage":"claudecode: resolve work_dir: %w","messagePattern":"claudecode: resolve work_dir: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/claudecode/claudecode.go","lineNumber":570,"sourceCode":"\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) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"claudecode: read project dir: %w\", err)\n\t}\n\n\tvar sessions []core.AgentSessionInfo\n\tfor _, entry := range entries {\n\t\tname := entry.Name()","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/claudecode/claudecode.go#L552-L588","documentation":"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.","triggerScenarios":"Thrown at agent/claudecode/claudecode.go:570 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"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"}