{"record":{"id":"13f65edad593dc1a","repo":"multica-ai/multica","slug":"upload-response-missing-attachment-url","errorCode":null,"errorMessage":"upload response missing attachment url","messagePattern":"upload response missing attachment url","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/cli/client.go","lineNumber":606,"sourceCode":"\t}\n\n\tresp, err := 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 AttachmentResponse\n\tif err := json.NewDecoder(resp.Body).Decode(&result); err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"decode upload response: %w\", err)\n\t}\n\tif result.URL == \"\" {\n\t\treturn \"\", \"\", fmt.Errorf(\"upload response missing attachment url\")\n\t}\n\t// Allow empty ID: the server returns id=\"\" in the fallback path where\n\t// S3 upload succeeded but the attachment DB record failed. The file\n\t// is still usable via its URL.\n\treturn result.ID, result.URL, nil\n}\n\n// ImportSkillFile imports a skill from a local archive (.skill / .zip) by\n// POSTing it as multipart/form-data to /api/skills/import, alongside the\n// on_conflict strategy. The structured import result is decoded into out.\nfunc (c *APIClient) ImportSkillFile(ctx context.Context, fileData []byte, filename, onConflict string, out any) error {\n\tvar body bytes.Buffer\n\twriter := multipart.NewWriter(&body)\n\n\tpart, err := writer.CreateFormFile(\"file\", filepath.Base(filename))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"create form file: %w\", err)\n\t}","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/cli/client.go#L588-L624","documentation":"Raised by APIClient.UploadFileWithURL as a response-contract guard: the upload succeeded (status <400, body decoded) but the AttachmentResponse carries no 'url', so there is nothing durable to return to the caller. The input at fault is the server's incomplete upload response (an empty id alone is explicitly allowed).","triggerScenarios":"Thrown at server/internal/cli/client.go:606 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the upload; if it persists, report the missing attachment url as a server bug."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}