googleapis/mcp-toolbox · error

failed to get metadata for object %q in bucket %q: %w

Error message

failed to get metadata for object %q in bucket %q: %w

What it means

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

Source

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

		return fmt.Sprint(bindings[i]["role"]) < fmt.Sprint(bindings[j]["role"])
	})

	return map[string]any{
		"bucket":   bucket,
		"bindings": bindings,
	}, nil
}

// GetObjectMetadata returns the raw *storage.ObjectAttrs for an object, giving
// callers the full field set the GCS client exposes (name, size, contentType,
// hashes, timestamps, user metadata, etc.) without a curated subset.
func (s *Source) GetObjectMetadata(ctx context.Context, bucket, object string) (*storage.ObjectAttrs, error) {
	if err := s.validateBucket(bucket); err != nil {
		return nil, err
	}
	attrs, err := s.client.Bucket(bucket).Object(object).Attrs(ctx)
	if err != nil {
		return nil, fmt.Errorf("failed to get metadata for object %q in bucket %q: %w", object, bucket, err)
	}
	return attrs, nil
}

// DownloadObject streams a GCS object to destination on the local filesystem.
// Unlike ReadObject there is no size cap and no UTF-8 check — the bytes go to
// disk, not into the LLM context, so binary payloads are fine. When overwrite
// is false, a pre-existing destination returns cloudstoragecommon.ErrDestinationExists
// (mapped to AgentError so the caller can retry with overwrite=true).
func (s *Source) DownloadObject(ctx context.Context, bucket, object, destination string, overwrite bool) (map[string]any, error) {
	if err := s.validateBucket(bucket); err != nil {
		return nil, err
	}
	if err := s.validateLocalPath(destination); err != nil {
		return nil, err
	}
	reader, err := s.client.Bucket(bucket).Object(object).NewReader(ctx)
	if err != nil {

View on GitHub (pinned to 8cc6e09de2)

When it happens

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