multica-ai/multica · error

upload accepts a local file path, not a URL: %s

Error message

upload accepts a local file path, not a URL: %s

What it means

The upload path of the attachment command only accepts a local file path. Before reading the file it checks the argument with isHTTPURL and rejects anything that looks like an http(s) URL, because the command has no fetch-remote-URL logic — it would just fail later in os.ReadFile with a confusing error.

Source

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

}

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

	taskID, _ := cmd.Flags().GetString("task")
	if taskID == "" {
		taskID = client.TaskID
	}
	if taskID == "" {
		return fmt.Errorf("no chat task in context: run inside a chat task (MULTICA_TASK_ID set) or pass --task <id>")
	}

	path := args[0]
	if isHTTPURL(path) {
		return fmt.Errorf("upload accepts a local file path, not a URL: %s", path)
	}
	data, err := os.ReadFile(path)
	if err != nil {
		return fmt.Errorf("read file %s: %w", path, err)
	}

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

	att, err := client.UploadChatAttachment(ctx, data, path, taskID)
	if err != nil {
		return fmt.Errorf("upload attachment: %w", err)
	}

	filename := filepath.Base(path)
	// Escape markdown label metacharacters in the filename so a name like
	// `report[v2].pdf` does not truncate the snippet's label. Files render as a
	// block-level attachment card via `!file[...]( )`; images render inline via

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Download the file locally first (curl/wget), then upload the local path: `curl -o report.pdf <url> && multica attachment upload report.pdf`
  2. If scripting, branch on the argument: URLs go through your own fetch step, local paths go to upload

Example fix

# before
multica attachment upload https://example.com/report.pdf

# after
curl -fsSL https://example.com/report.pdf -o /tmp/report.pdf
multica attachment upload /tmp/report.pdf --task 42
Defensive patterns

Strategy: validation

Validate before calling

# shell: route URLs to a fetch step first
case "$path" in http://*|https://*) curl -fsSL "$path" -o /tmp/up.bin; path=/tmp/up.bin;; esac
multica attachment upload "$path" --task "$tid"

Prevention

When it happens

Trigger: Calling `multica attachment upload https://example.com/report.pdf` — passing a remote URL instead of a local path.

Common situations: Users pasting a link received in chat and expecting the CLI to fetch it; scripts that forward whatever path string they have, including URLs; copy-paste from docs examples that mix download (which takes an id) and upload.

Related errors


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