multica-ai/multica · error
download file: %w
Error message
download file: %w
What it means
Once the command has the signed download_url, it fetches the bytes with client.DownloadFile under a 60s timeout. This error wraps any failure of that fetch: expired signed URL, DNS/network failure to the storage host, or a 403 from object storage.
Source
Thrown at server/cmd/multica/cmd_attachment.go:157
var att map[string]any
if err := client.GetJSON(ctx, "/api/attachments/"+args[0], &att); err != nil {
return fmt.Errorf("get attachment: %w", err)
}
downloadURL := strVal(att, "download_url")
if downloadURL == "" {
return fmt.Errorf("attachment has no download URL")
}
filename := filepath.Base(strVal(att, "filename"))
if filename == "" || filename == "." {
filename = args[0]
}
// Download the file content.
data, err := client.DownloadFile(ctx, downloadURL)
if err != nil {
return fmt.Errorf("download file: %w", err)
}
// Write to the output directory, creating it if needed so `-o` works
// against a directory that does not exist yet (the help example's
// `-o ./attachments` in a clean workdir).
outputDir, _ := cmd.Flags().GetString("output-dir")
if outputDir != "" {
if err := os.MkdirAll(outputDir, 0o755); err != nil {
return fmt.Errorf("create output directory: %w", err)
}
}
destPath := filepath.Join(outputDir, filename)
if err := os.WriteFile(destPath, data, 0o644); err != nil {
return fmt.Errorf("write file: %w", err)
}
// Print the absolute path so agents can reference the file.View on GitHub (pinned to 2c0912b6ec)
Solutions
- Retry the download — a fresh run gets a newly signed URL
- Allow egress to the storage/host serving download_url in firewall/proxy rules
- For large files on slow links, download from a machine with better bandwidth or increase the CLI timeout env if supported
- Check system clock (significant skew can invalidate signatures)
Example fix
# retry pattern in shell (fresh signed URL each attempt) for i in 1 2 3; do multica attachment download "$id" -o ./attachments && break; sleep 5; done
Defensive patterns
Strategy: retry
Try / catch
# signed URLs are freshly minted per run — one retry fixes expiry for i in 1 2; do multica attachment download "$id" -o ./attachments && exit 0; sleep 2; done; exit 1
Prevention
- Download immediately after fetching metadata — signed URLs have short lifetimes
- Allow egress to the storage host in firewall rules for agent environments
When it happens
Trigger: Metadata was fetched but the signed URL expired before the download started (long queue, paused terminal); egress blocked to the storage domain (air-gapped agent sandbox, firewall); clock skew invalidating the signature; storage outage.
Common situations: Agent containers with restricted egress allowing only the API host; slow links where the 60s timeout is exceeded for large files; sitting on the metadata too long before downloading.
Related errors
- get attachment: %w
- upload attachment: %w
- attachment has no download URL
- create output directory: %w
- write file: %w
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/f69def951bb9cc38.
Report an issue: GitHub.