{"record":{"id":"56ea51833e16b51a","repo":"multica-ai/multica","slug":"decode-upload-response-w","errorCode":null,"errorMessage":"decode upload response: %w","messagePattern":"decode upload response: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/cli/client.go","lineNumber":478,"sourceCode":"\t\treturn \"\", err\n\t}\n\treq.Header.Set(\"Content-Type\", writer.FormDataContentType())\n\tc.setHeaders(req)\n\n\tresp, err := c.HTTPClient.Do(req)\n\terr = wrapTransport(req, err)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode >= 400 {\n\t\treturn \"\", newHTTPError(http.MethodPost, \"/api/upload-file\", resp)\n\t}\n\n\tvar result map[string]any\n\tif err := json.NewDecoder(resp.Body).Decode(&result); err != nil {\n\t\treturn \"\", fmt.Errorf(\"decode upload response: %w\", err)\n\t}\n\n\tid, _ := result[\"id\"].(string)\n\tif id == \"\" {\n\t\treturn \"\", fmt.Errorf(\"upload response missing attachment id\")\n\t}\n\treturn id, nil\n}\n\n// UploadChatAttachment uploads a file via multipart form to /api/upload-file\n// tagged with a chat task (task_id). The server binds the row to the assistant\n// reply that task produces on completion. Returns the full AttachmentResponse\n// (id + markdown_url) so the agent can embed the image inline in its reply.\nfunc (c *APIClient) UploadChatAttachment(ctx context.Context, fileData []byte, filename, taskID string) (AttachmentResponse, error) {\n\tvar body bytes.Buffer\n\twriter := multipart.NewWriter(&body)\n\n\tpart, err := writer.CreateFormFile(\"file\", filepath.Base(filename))","sourceCodeStart":460,"sourceCodeEnd":496,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/cli/client.go#L460-L496","documentation":"Error \"decode upload response: %w\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/internal/cli/client.go:478 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check server version compatibility; the upload response could not be decoded."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}