{"record":{"id":"23fbe3835500ec85","repo":"googleapis/mcp-toolbox","slug":"failed-to-open-source-q-w","errorCode":null,"errorMessage":"failed to open source %q: %w","messagePattern":"failed to open source %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/cloudstorage/cloudstorage.go","lineNumber":471,"sourceCode":"\t\t\"contentType\": reader.Attrs.ContentType,\n\t}, nil\n}\n\n// UploadObject streams a local file into a GCS object. When contentType is\n// empty, mime.TypeByExtension is consulted; if inference still fails the\n// writer's ContentType is left unset so GCS content-sniffs the first 512 bytes.\n// The returned contentType is the post-Close value from w.Attrs(), i.e. what\n// GCS actually recorded.\nfunc (s *Source) UploadObject(ctx context.Context, bucket, object, source, contentType string) (map[string]any, error) {\n\tif err := s.validateBucket(bucket); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := s.validateLocalPath(source); err != nil {\n\t\treturn nil, err\n\t}\n\tf, err := os.Open(source)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open source %q: %w\", source, err)\n\t}\n\tdefer f.Close()\n\n\tif contentType == \"\" {\n\t\tcontentType = mime.TypeByExtension(filepath.Ext(source))\n\t}\n\n\tw := s.client.Bucket(bucket).Object(object).NewWriter(ctx)\n\tif contentType != \"\" {\n\t\tw.ContentType = contentType\n\t}\n\n\tn, err := io.Copy(w, f)\n\tif err != nil {\n\t\t_ = w.Close()\n\t\treturn nil, fmt.Errorf(\"failed to copy %q to object %q in bucket %q: %w\", source, object, bucket, err)\n\t}\n\tif err := w.Close(); err != nil {","sourceCodeStart":453,"sourceCodeEnd":489,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/cloudstorage/cloudstorage.go#L453-L489","documentation":"Error \"failed to open source %q: %w\" thrown in googleapis/mcp-toolbox.","triggerScenarios":"Thrown at internal/sources/cloudstorage/cloudstorage.go:471 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}