diff --git a/private/buf/cmd/buf/command/beta/registry/archive/archive.go b/private/buf/cmd/buf/command/beta/registry/archive/archive.go index b82930548e..78ae7d2b45 100644 --- a/private/buf/cmd/buf/command/beta/registry/archive/archive.go +++ b/private/buf/cmd/buf/command/beta/registry/archive/archive.go @@ -106,6 +106,9 @@ func run( } registryToModuleFullNames := map[string][]bufmodule.ModuleFullName{} for _, module := range workspace.Modules() { + if !module.IsTarget() { + continue + } if moduleFullName := module.ModuleFullName(); moduleFullName != nil { moduleFullNames, ok := registryToModuleFullNames[moduleFullName.Registry()] if !ok { diff --git a/private/buf/cmd/buf/command/beta/registry/unarchive/unarchive.go b/private/buf/cmd/buf/command/beta/registry/unarchive/unarchive.go index e815775abc..a50fb1204a 100644 --- a/private/buf/cmd/buf/command/beta/registry/unarchive/unarchive.go +++ b/private/buf/cmd/buf/command/beta/registry/unarchive/unarchive.go @@ -106,6 +106,9 @@ func run( } registryToModuleFullNames := map[string][]bufmodule.ModuleFullName{} for _, module := range workspace.Modules() { + if !module.IsTarget() { + continue + } if moduleFullName := module.ModuleFullName(); moduleFullName != nil { moduleFullNames, ok := registryToModuleFullNames[moduleFullName.Registry()] if !ok {