multica-ai/multica · error

upload response missing attachment url

Error message

upload response missing attachment url

What it means

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).

Solutions

  1. Retry the upload; if it persists, report the missing attachment url as a server bug.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/internal/cli/client.go:606 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at server/internal/cli/client.go:606

	}

	resp, err := httpClient.Do(req)
	err = wrapTransport(req, err)
	if err != nil {
		return "", "", err
	}
	defer resp.Body.Close()

	if resp.StatusCode >= 400 {
		return "", "", newHTTPError(http.MethodPost, "/api/upload-file", resp)
	}

	var result AttachmentResponse
	if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
		return "", "", fmt.Errorf("decode upload response: %w", err)
	}
	if result.URL == "" {
		return "", "", fmt.Errorf("upload response missing attachment url")
	}
	// Allow empty ID: the server returns id="" in the fallback path where
	// S3 upload succeeded but the attachment DB record failed. The file
	// is still usable via its URL.
	return result.ID, result.URL, nil
}

// ImportSkillFile imports a skill from a local archive (.skill / .zip) by
// POSTing it as multipart/form-data to /api/skills/import, alongside the
// on_conflict strategy. The structured import result is decoded into out.
func (c *APIClient) ImportSkillFile(ctx context.Context, fileData []byte, filename, onConflict string, out any) error {
	var body bytes.Buffer
	writer := multipart.NewWriter(&body)

	part, err := writer.CreateFormFile("file", filepath.Base(filename))
	if err != nil {
		return fmt.Errorf("create form file: %w", err)
	}

View on GitHub (pinned to 2c0912b6ec)