{"record":{"id":"e1deca0ed5deff7f","repo":"multica-ai/multica","slug":"upload-accepts-a-local-file-path-not-a-url-s","errorCode":null,"errorMessage":"upload accepts a local file path, not a URL: %s","messagePattern":"upload accepts a local file path, not a URL: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_attachment.go","lineNumber":79,"sourceCode":"}\n\nfunc runAttachmentUpload(cmd *cobra.Command, args []string) error {\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttaskID, _ := cmd.Flags().GetString(\"task\")\n\tif taskID == \"\" {\n\t\ttaskID = client.TaskID\n\t}\n\tif taskID == \"\" {\n\t\treturn fmt.Errorf(\"no chat task in context: run inside a chat task (MULTICA_TASK_ID set) or pass --task <id>\")\n\t}\n\n\tpath := args[0]\n\tif isHTTPURL(path) {\n\t\treturn fmt.Errorf(\"upload accepts a local file path, not a URL: %s\", path)\n\t}\n\tdata, err := os.ReadFile(path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"read file %s: %w\", path, err)\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), cli.AtLeastAPITimeout(60*time.Second))\n\tdefer cancel()\n\n\tatt, err := client.UploadChatAttachment(ctx, data, path, taskID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"upload attachment: %w\", err)\n\t}\n\n\tfilename := filepath.Base(path)\n\t// Escape markdown label metacharacters in the filename so a name like\n\t// `report[v2].pdf` does not truncate the snippet's label. Files render as a\n\t// block-level attachment card via `!file[...]( )`; images render inline via","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_attachment.go#L61-L97","documentation":"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.","triggerScenarios":"Calling `multica attachment upload https://example.com/report.pdf` — passing a remote URL instead of a local path.","commonSituations":"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.","solutions":["Download the file locally first (curl/wget), then upload the local path: `curl -o report.pdf <url> && multica attachment upload report.pdf`","If scripting, branch on the argument: URLs go through your own fetch step, local paths go to upload"],"exampleFix":"# before\nmultica attachment upload https://example.com/report.pdf\n\n# after\ncurl -fsSL https://example.com/report.pdf -o /tmp/report.pdf\nmultica attachment upload /tmp/report.pdf --task 42","handlingStrategy":"validation","validationCode":"# shell: route URLs to a fetch step first\ncase \"$path\" in http://*|https://*) curl -fsSL \"$path\" -o /tmp/up.bin; path=/tmp/up.bin;; esac\nmultica attachment upload \"$path\" --task \"$tid\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Normalize user-supplied paths before passing to the CLI: download URLs yourself, then upload the local file"],"tags":["cli","attachment","validation","user-input"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}