{"record":{"id":"54a9c8665ab1a12c","repo":"microg/GmsCore","slug":"attestation-conveyance-preference-attachment-no","errorCode":null,"errorMessage":"Attestation conveyance preference ${attachment} not supported","messagePattern":"Attestation conveyance preference (.+?) not supported","errorType":"error_code","errorClass":"UnsupportedAttestationConveyancePreferenceException","httpStatus":null,"severity":"error","filePath":"play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AttestationConveyancePreference.java","lineNumber":52,"sourceCode":"    }\n\n    @Override\n    public int describeContents() {\n        return 0;\n    }\n\n    @Override\n    public void writeToParcel(Parcel dest, int flags) {\n        dest.writeString(toString());\n    }\n\n    @Hide\n    @NonNull\n    public static AttestationConveyancePreference fromString(String attachment) throws UnsupportedAttestationConveyancePreferenceException {\n        for (AttestationConveyancePreference value : values()) {\n            if (value.value.equals(attachment)) return value;\n        }\n        throw new UnsupportedAttestationConveyancePreferenceException(\"Attestation conveyance preference \" + attachment + \" not supported\");\n    }\n\n    public static Creator<AttestationConveyancePreference> CREATOR = new Creator<AttestationConveyancePreference>() {\n        @Override\n        public AttestationConveyancePreference createFromParcel(Parcel source) {\n            try {\n                return AttestationConveyancePreference.fromString(source.readString());\n            } catch (UnsupportedAttestationConveyancePreferenceException e) {\n                throw new RuntimeException(e);\n            }\n        }\n\n        @Override\n        public AttestationConveyancePreference[] newArray(int size) {\n            return new AttestationConveyancePreference[size];\n        }\n    };\n","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AttestationConveyancePreference.java#L34-L70","documentation":"AttestationConveyancePreference.fromString() maps an attestation conveyance string (\"none\", \"indirect\", \"direct\", \"enterprise\") to the enum. Unrecognized values throw UnsupportedAttestationConveyancePreferenceException so bad attestation settings fail fast rather than being ignored.","triggerScenarios":"Calling fromString with a value outside the enum, e.g. a typo like \"attestation-direct\", the empty string, or a newer spec value not present in this library version. (The message text mistakenly says 'attachment' — it refers to the conveyance preference.)","commonSituations":"Server-issued WebAuthn options containing attestation values from a newer spec than the embedded library supports; hand-written option JSON in tests with case errors (\"Direct\").","solutions":["Use one of the supported strings exactly: \"none\", \"indirect\", \"direct\" (or \"enterprise\" if the enum defines it).","Prefer the enum constants directly instead of parsing strings.","Update the microG FIDO library if a newer preference value must be accepted."],"exampleFix":"// before\nvar pref = AttestationConveyancePreference.fromString(\"attestation-direct\");\n// after\nvar pref = AttestationConveyancePreference.fromString(\"direct\");","handlingStrategy":"validation","validationCode":"boolean valid = java.util.Arrays.stream(AttestationConveyancePreference.values()).anyMatch(p -> p.toString().equals(preference));\nif (!valid) preference = \"none\";","typeGuard":null,"tryCatchPattern":"try { pref = AttestationConveyancePreference.fromString(value); } catch (UnsupportedAttestationConveyancePreferenceException e) { pref = AttestationConveyancePreference.fromString(\"none\"); }","preventionTips":["Whitelist the accepted strings (\"none\", \"indirect\", \"direct\") before parsing.","Default to \"none\" when the server value is unknown — attestation is optional.","Use enum constants when constructing PublicKeyCredentialCreationOptions directly."],"tags":["fido","webauthn","enum-parsing","android"],"backgroundTag":"invalid-enum-value","analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}