{"record":{"id":"b11f042d44eff66e","repo":"microg/GmsCore","slug":"attachment-attachment-not-supported","errorCode":null,"errorMessage":"Attachment ${attachment} not supported","messagePattern":"Attachment (.+?) not supported","errorType":"error_code","errorClass":"UnsupportedAttachmentException","httpStatus":null,"severity":"error","filePath":"play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/Attachment.java","lineNumber":48,"sourceCode":"        return value;\n    }\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    public static Attachment fromString(String attachment) throws UnsupportedAttachmentException {\n        for (Attachment value : values()) {\n            if (value.value.equals(attachment)) return value;\n        }\n        throw new UnsupportedAttachmentException(\"Attachment \" + attachment + \" not supported\");\n    }\n\n    public static Creator<Attachment> CREATOR = new Creator<Attachment>() {\n        @Override\n        public Attachment createFromParcel(Parcel source) {\n            try {\n                return Attachment.fromString(source.readString());\n            } catch (Attachment.UnsupportedAttachmentException e) {\n                throw new RuntimeException(e);\n            }\n        }\n\n        @Override\n        public Attachment[] newArray(int size) {\n            return new Attachment[size];\n        }\n    };\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/Attachment.java#L30-L66","documentation":"Attachment.fromString() converts an attachment string (\"platform\" or \"cross-platform\") to the Attachment enum; any other value throws UnsupportedAttachmentException. Note the Creator's createFromParcel catches this and falls back, so the exception mainly surfaces on direct fromString calls and manual JSON handling.","triggerScenarios":"Calling Attachment.fromString with any string other than \"platform\" or \"cross-platform\", e.g. \"hybrid\" (an attachment-style value from newer WebAuthn drafts), \"\", or null.","commonSituations":"Building PublicKeyCredentialCreationOptions/RequestOptions from server JSON that uses newer attachment values; typos like \"Platform\" (case-sensitive compare) in config or test data.","solutions":["Pass exactly \"platform\" or \"cross-platform\" (lowercase, as defined by the enum).","Validate the attachment string against the enum values before calling fromString.","If \"hybrid\" is required, upgrade to a library version that models it; otherwise map it manually to null/cross-platform."],"exampleFix":"// before\nAttachment att = Attachment.fromString(\"hybrid\");\n// after\nAttachment att = att.equals(\"hybrid\") ? Attachment.fromString(\"cross-platform\") : Attachment.fromString(att);","handlingStrategy":"validation","validationCode":"boolean valid = java.util.Arrays.stream(Attachment.values()).anyMatch(a -> a.toString().equals(attachment));\nif (!valid) attachment = null; // or substitute \"cross-platform\"","typeGuard":null,"tryCatchPattern":"try { att = Attachment.fromString(value); } catch (UnsupportedAttachmentException e) { att = null; }","preventionTips":["Only pass the exact lowercase literals \"platform\"/\"cross-platform\".","Check for case mismatches — fromString is case-sensitive.","Prefer setting enum constants on options objects rather than round-tripping strings."],"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"}