chenhg5/cc-connect · error
opencodeSession: save image: %w
Error message
opencodeSession: save image: %w
What it means
Fires while staging image attachments for an opencode prompt: the image directory could not be created under <workDir>/.cc-connect/images (permissions, read-only filesystem) or an individual image could not be written to disk. Wraps the underlying os error so the caller (Send) aborts the message send with a clear cause.
Source
Thrown at agent/opencode/session.go:134
}
func (s *opencodeSession) stageImages(prompt string, images []core.ImageAttachment) (string, []string, error) {
if len(images) == 0 {
return prompt, nil, nil
}
imgDir := filepath.Join(s.workDir, ".cc-connect", "images")
if err := os.MkdirAll(imgDir, 0o755); err != nil {
return "", nil, fmt.Errorf("opencodeSession: create image dir: %w", err)
}
imagePaths := make([]string, 0, len(images))
for i, img := range images {
ext := opencodeImageExt(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("opencodeSession: save image: %w", err)
}
imagePaths = append(imagePaths, fpath)
}
if prompt == "" {
prompt = "Please analyze the attached image(s)."
}
return prompt, imagePaths, nil
}
func opencodeImageExt(mimeType string) string {
switch mimeType {
case "image/jpeg":
return ".jpg"
case "image/gif":
return ".gif"
case "image/webp":View on GitHub (pinned to 4000b2338a)
Solutions
- Free disk space on the workDir volume
- Check for filesystem/quota errors
- Retry the send after repair
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at agent/opencode/session.go:134 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/8f06557a4e51fd64.
Report an issue: GitHub.