multica-ai/multica · error

get attachment: %w

Error message

get attachment: %w

What it means

The download command first fetches attachment metadata via GET /api/attachments/{id} using client.GetJSON. This error wraps any failure of that request: 404 for an unknown id, 401/403 for bad auth, network errors, or malformed JSON responses.

Source

Thrown at server/cmd/multica/cmd_attachment.go:141

		`]`, `\]`,
		`(`, `\(`,
		`)`, `\)`,
	).Replace(s)
}

func runAttachmentDownload(cmd *cobra.Command, args []string) error {
	client, err := newAPIClient(cmd)
	if err != nil {
		return err
	}

	ctx, cancel := context.WithTimeout(context.Background(), cli.AtLeastAPITimeout(60*time.Second))
	defer cancel()

	// Fetch attachment metadata (includes signed download_url).
	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)
	}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Double-check the attachment id (copy the full id, no surrounding markdown)
  2. Verify auth and target server: `multica auth status` and the configured server URL
  3. Confirm the attachment still exists (re-list attachments for the task)
  4. Check network/proxy settings if the server is unreachable
Defensive patterns

Strategy: validation

Validate before calling

# validate id shape before calling (non-empty, no slashes/whitespace)
case "$id" in ''|*[!A-Za-z0-9_-]*) echo "bad attachment id: $id" >&2; exit 1;; esac

Prevention

When it happens

Trigger: Passing a wrong or truncated attachment id to `multica attachment download <id>`; token lacking access to the attachment's workspace; server down or unreachable; attachment deleted between listing and downloading.

Common situations: Copy-pasting an id with extra characters or a missing suffix; using an old token after workspace switch; scripts reusing cached ids after the attachment expired; CLI pointed at the wrong server URL.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/55e7cd3849672fa3. Report an issue: GitHub.