chenhg5/cc-connect · warning
attachment send is disabled by config
Error message
attachment send is disabled by config
What it means
ErrAttachmentSendDisabled is a sentinel error in the engine indicating that side-channel delivery of images/files is turned off in config. When a message contains attachments but attachmentSendEnabled is false, the engine refuses to deliver them instead of silently dropping them. It is a deliberate policy error, not an infrastructure failure.
Source
Thrown at core/engine.go:105
replyFooterUsageTimeout = 1500 * time.Millisecond
replyFooterUsageCacheTTL = 30 * time.Second
)
const (
messageRecallCheckTimeout = 2 * time.Second
messageRecallPollInterval = 2 * time.Second
messageRecallProbeCooldown = time.Minute
recalledStopLockWait = 2 * time.Second
)
// VersionInfo is set by main at startup so that /version works.
var VersionInfo string
// CurrentVersion is the semver tag (e.g. "v1.2.0-beta.1"), set by main.
var CurrentVersion string
// ErrAttachmentSendDisabled indicates that side-channel image/file delivery is disabled by config.
var ErrAttachmentSendDisabled = errors.New("attachment send is disabled by config")
// RestartRequest carries info needed to send a post-restart notification.
type RestartRequest struct {
SessionKey string `json:"session_key"`
Platform string `json:"platform"`
}
type replyFooterUsageCache struct {
text string
fetchedAt time.Time
}
// SaveRestartNotify persists restart info so the new process can send
// a "restart successful" message after startup.
func SaveRestartNotify(dataDir string, req RestartRequest) error {
dir := filepath.Join(dataDir, "run")
if err := os.MkdirAll(dir, 0o755); err != nil {
slog.Warn("SaveRestartNotify: mkdir failed", "dir", dir, "error", err)View on GitHub (pinned to 4000b2338a)
Solutions
- Enable attachment sending in config.toml (set the attachment-send option to true) and restart cc-connect.
- Strip or skip images/files before calling the send path when attachment sending is known to be disabled.
- Handle the sentinel with errors.Is(err, core.ErrAttachmentSendDisabled) and surface a user-friendly 'attachments not allowed' message.
Example fix
// before
if err := e.sendToSessionWithAttachments(ctx, key, text, images, files); err != nil {
return err
}
// after
if err := e.sendToSessionWithAttachments(ctx, key, text, images, files); err != nil {
if errors.Is(err, core.ErrAttachmentSendDisabled) {
return e.Reply(ctx, replyCtx, "Attachments are disabled on this server.")
}
return err
} Defensive patterns
Strategy: try-catch
Validate before calling
if !e.attachmentSendEnabled && (len(images) > 0 || len(files) > 0) {
// skip attachment path up front
} Try / catch
if errors.Is(err, core.ErrAttachmentSendDisabled) {
// inform user attachments are disabled; do not retry
} Prevention
- Check the attachment-send config flag before sending messages that may contain images/files.
- Use errors.Is against the sentinel rather than string comparison.
- Document in config.example.toml that attachment sending is opt-in.
When it happens
Trigger: Calling the engine's send paths (core/engine.go:11195 and core/engine.go:11273) with non-empty images or files slices while e.attachmentSendEnabled is false, i.e. the config disabled attachment sending.
Common situations: Operator set attachment_send=false (or equivalent) in config.toml for security/compliance; a platform adapter forwards rich messages with images; a user sends a screenshot to the bot; tests like TestSendToSessionWithAttachmentsRespectsDisabledAttachmentSend exercise this path.
Related errors
- cron project not found
- VerifyRunAsUserCheap: runAsUser is empty
- RunIsolationProbe: RunAsUser is empty
- PreflightRunAsUser: RunAsUser is empty
- parse existing Agy hooks %s: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/95a23215201bbacd.
Report an issue: GitHub.