diff --git a/syft/formats/formats.go b/syft/formats/formats.go index 32a53795719..7275e54a638 100644 --- a/syft/formats/formats.go +++ b/syft/formats/formats.go @@ -2,10 +2,12 @@ package formats import ( "bytes" + "errors" "fmt" "io" "strings" + "github.com/anchore/syft/internal/log" "github.com/anchore/syft/syft/formats/cyclonedxjson" "github.com/anchore/syft/syft/formats/cyclonedxxml" "github.com/anchore/syft/syft/formats/github" @@ -35,6 +37,9 @@ func Formats() []sbom.Format { func Identify(by []byte) sbom.Format { for _, f := range Formats() { if err := f.Validate(bytes.NewReader(by)); err != nil { + if !errors.Is(err, sbom.ErrValidationNotSupported) { + log.Debugf("format %s returned err: %+v", f.ID(), err) + } continue } return f diff --git a/syft/formats/spdxtagvalue/decoder.go b/syft/formats/spdxtagvalue/decoder.go index d13c07560a7..a52d5138ca5 100644 --- a/syft/formats/spdxtagvalue/decoder.go +++ b/syft/formats/spdxtagvalue/decoder.go @@ -13,7 +13,7 @@ import ( func decoder(reader io.Reader) (*sbom.SBOM, error) { doc, err := tvloader.Load2_3(reader) if err != nil { - return nil, fmt.Errorf("unable to decode spdx-json: %w", err) + return nil, fmt.Errorf("unable to decode spdx-tag-value: %w", err) } return spdxhelpers.ToSyftModel(doc)