chenhg5/cc-connect · error
codexSession: create image dir: %w
Error message
codexSession: create image dir: %w
What it means
Wraps a failed os.MkdirAll of <workDir>/.cc-connect/images in codexSession.stageImages. It fires when the working directory (or the .cc-connect subdir) is not writable, so image attachments cannot be staged for the prompt.
Source
Thrown at agent/codex/session.go:185
if err := cmd.Start(); err != nil {
return fmt.Errorf("codexSession: start: %w", err)
}
cs.addCmd(cmd)
cs.wg.Add(1)
go cs.readLoop(cmd, stdout, &stderrBuf)
return nil
}
func (cs *codexSession) stageImages(prompt string, images []core.ImageAttachment) (string, []string, error) {
if len(images) == 0 {
return prompt, nil, nil
}
imgDir := filepath.Join(cs.workDir, ".cc-connect", "images")
if err := os.MkdirAll(imgDir, 0o755); err != nil {
return "", nil, fmt.Errorf("codexSession: create image dir: %w", err)
}
imagePaths := make([]string, 0, len(images))
for i, img := range images {
ext := codexImageExt(img.MimeType)
fname := fmt.Sprintf("img_%d_%d%s", time.Now().UnixMilli(), i, ext)
fpath := filepath.Join(imgDir, fname)
if err := os.WriteFile(fpath, img.Data, 0o644); err != nil {
return "", nil, fmt.Errorf("codexSession: save image: %w", err)
}
imagePaths = append(imagePaths, fpath)
}
if strings.TrimSpace(prompt) == "" {
prompt = "Please analyze the attached image(s)."
}
return prompt, imagePaths, nilView on GitHub (pinned to 4000b2338a)
Solutions
- Fix write permissions on the project workDir
- Ensure .cc-connect is not blocked by an existing file of that name
- Retry the message with the image after repair
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at agent/codex/session.go:185 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/8a162ef39a7557f0.
Report an issue: GitHub.