@@ -2,10 +2,12 @@ package catalognext
22
33import (
44 "context"
5+ "errors"
56 "fmt"
67 "time"
78
89 "github.com/google/go-containerregistry/pkg/name"
10+ "github.com/google/go-containerregistry/pkg/v1/remote/transport"
911
1012 "github.com/docker/mcp-gateway/pkg/db"
1113 "github.com/docker/mcp-gateway/pkg/oci"
@@ -41,6 +43,9 @@ func pullCatalog(ctx context.Context, dao db.DAO, ociService oci.Service, refStr
4143
4244 catalogArtifact , err := oci .ReadArtifact [CatalogArtifact ](refStr , MCPCatalogArtifactType )
4345 if err != nil {
46+ if isNotFoundError (err ) {
47+ return nil , fmt .Errorf ("catalog not found: %s" , oci .FullNameWithoutDigest (ref ))
48+ }
4449 return nil , fmt .Errorf ("failed to read OCI catalog: %w" , err )
4550 }
4651
@@ -88,3 +93,18 @@ func pullCatalog(ctx context.Context, dao db.DAO, ociService oci.Service, refStr
8893
8994 return & dbCatalog , nil
9095}
96+
97+ // isNotFoundError checks if the error is an OCI registry "not found" response
98+ // (MANIFEST_UNKNOWN or NAME_UNKNOWN).
99+ func isNotFoundError (err error ) bool {
100+ var transportErr * transport.Error
101+ if ! errors .As (err , & transportErr ) {
102+ return false
103+ }
104+ for _ , diagnostic := range transportErr .Errors {
105+ if diagnostic .Code == transport .ManifestUnknownErrorCode || diagnostic .Code == transport .NameUnknownErrorCode {
106+ return true
107+ }
108+ }
109+ return false
110+ }
0 commit comments