chenhg5/cc-connect · error

wps-agentspace: SendFile: %w

Error message

wps-agentspace: SendFile: %w

What it means

Wrapped error from saveAttachment when handling SendFile: persisting the attachment bytes to the shared directory failed (disk full, permission denied, unwritable path), so no local path notice can be sent to the chat.

Source

Thrown at platform/wps-agentspace/wpsagentspace.go:227

	rc, ok := replyCtx.(*replyContext)
	if !ok {
		return fmt.Errorf("wps-agentspace: invalid reply context type")
	}
	return p.sendText(rc.ChatID, content, rc)
}

// SendFile implements core.FileSender. The WPS Agentspace WebSocket protocol
// has no native binary file frame, so we persist the file to a shared
// directory and reply with a path the user can open locally.
func (p *Platform) SendFile(ctx context.Context, replyCtx any, file core.FileAttachment) error {
	rc, ok := replyCtx.(*replyContext)
	if !ok {
		return fmt.Errorf("wps-agentspace: SendFile: invalid reply context type %T", replyCtx)
	}

	path, err := p.saveAttachment(file.FileName, file.Data)
	if err != nil {
		return fmt.Errorf("wps-agentspace: SendFile: %w", err)
	}

	notice := fmt.Sprintf("📎 文件已保存到本地:\n%s", path)
	return p.sendText(rc.ChatID, notice, rc)
}

// SendImage implements core.ImageSender. Same disk-persist fallback as SendFile.
func (p *Platform) SendImage(ctx context.Context, replyCtx any, img core.ImageAttachment) error {
	rc, ok := replyCtx.(*replyContext)
	if !ok {
		return fmt.Errorf("wps-agentspace: SendImage: invalid reply context type %T", replyCtx)
	}

	name := img.FileName
	if name == "" {
		ext := ".png"
		if strings.HasPrefix(img.MimeType, "image/jpeg") {
			ext = ".jpg"

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Check that the shared attachment directory exists and is writable by the service user
  2. Free disk space or raise quotas on the volume backing the shared directory
  3. Verify the configured save path is absolute and not read-only (e.g. not inside a container mount lacking write perms)
  4. Log the failing path alongside the error to pinpoint which mount is at fault
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at platform/wps-agentspace/wpsagentspace.go:227 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/6c9f7151947e753e. Report an issue: GitHub.