googleapis/mcp-toolbox · error

destination %q: %w

Error message

destination %q: %w

What it means

Error "destination %q: %w" thrown in googleapis/mcp-toolbox.

Source

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

	if err := s.validateLocalPath(destination); err != nil {
		return nil, err
	}
	reader, err := s.client.Bucket(bucket).Object(object).NewReader(ctx)
	if err != nil {
		return nil, fmt.Errorf("failed to open object %q in bucket %q: %w", object, bucket, err)
	}
	defer reader.Close()

	flags := os.O_WRONLY | os.O_CREATE
	if overwrite {
		flags |= os.O_TRUNC
	} else {
		flags |= os.O_EXCL
	}
	f, err := os.OpenFile(destination, flags, 0o644)
	if err != nil {
		if errors.Is(err, os.ErrExist) {
			return nil, fmt.Errorf("destination %q: %w", destination, cloudstoragecommon.ErrDestinationExists)
		}
		return nil, fmt.Errorf("failed to open destination %q: %w", destination, err)
	}

	n, err := io.Copy(f, reader)
	if err != nil {
		_ = f.Close()
		return nil, fmt.Errorf("failed to write object %q to %q: %w", object, destination, err)
	}
	if err := f.Close(); err != nil {
		return nil, fmt.Errorf("failed to close destination %q: %w", destination, err)
	}

	return map[string]any{
		"destination": destination,
		"bytes":       n,
		"contentType": reader.Attrs.ContentType,
	}, nil

View on GitHub (pinned to 8cc6e09de2)

When it happens

Trigger: Thrown at internal/sources/cloudstorage/cloudstorage.go:436 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/8540fe7f223ef3a9. Report an issue: GitHub.