googleapis/mcp-toolbox · error

failed to copy %q to object %q in bucket %q: %w

Error message

failed to copy %q to object %q in bucket %q: %w

What it means

Error "failed to copy %q to object %q in bucket %q: %w" thrown in googleapis/mcp-toolbox.

Source

Thrown at internal/sources/cloudstorage/cloudstorage.go:487

	f, err := os.Open(source)
	if err != nil {
		return nil, fmt.Errorf("failed to open source %q: %w", source, err)
	}
	defer f.Close()

	if contentType == "" {
		contentType = mime.TypeByExtension(filepath.Ext(source))
	}

	w := s.client.Bucket(bucket).Object(object).NewWriter(ctx)
	if contentType != "" {
		w.ContentType = contentType
	}

	n, err := io.Copy(w, f)
	if err != nil {
		_ = w.Close()
		return nil, fmt.Errorf("failed to copy %q to object %q in bucket %q: %w", source, object, bucket, err)
	}
	if err := w.Close(); err != nil {
		return nil, fmt.Errorf("failed to finalize upload of %q to %q/%q: %w", source, bucket, object, err)
	}

	attrs := w.Attrs()
	finalContentType := ""
	if attrs != nil {
		finalContentType = attrs.ContentType
	}
	return map[string]any{
		"bucket":      bucket,
		"object":      object,
		"bytes":       n,
		"contentType": finalContentType,
	}, nil
}

View on GitHub (pinned to 8cc6e09de2)

When it happens

Trigger: Thrown at internal/sources/cloudstorage/cloudstorage.go:487 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/68ea2c18d2a8de6d. Report an issue: GitHub.