This error Code: 6 is caused by an Audience error, duplicate Audience, or inconsistent context. I have a duplicate Audience here, so the error is reported.
<saml:AudienceRestriction> <saml:Audience>https://sp.example.com/remote/saml/metadata/</saml:Audience> <saml:Audience>https://sp.example.com/remote/saml/metadata/</saml:Audience> </saml:AudienceRestriction>
If there is an empty Audience, an error Code: 6 will be reported.
<saml:AudienceRestriction> <saml:Audience>https://sp.example.com/remote/saml/metadata/</saml:Audience> <saml:Audience/> </saml:AudienceRestriction>
The correct one is as follows
<saml:AudienceRestriction> <saml:Audience>https://sp.example.com/remote/saml/metadata/</saml:Audience> </saml:AudienceRestriction>