microg/GmsCore · error · UnsupportedAttachmentException
Attachment ${attachment} not supported
Error message
Attachment ${attachment} not supported What it means
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.
Source
Thrown at play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/Attachment.java:48
return value;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(toString());
}
@Hide
public static Attachment fromString(String attachment) throws UnsupportedAttachmentException {
for (Attachment value : values()) {
if (value.value.equals(attachment)) return value;
}
throw new UnsupportedAttachmentException("Attachment " + attachment + " not supported");
}
public static Creator<Attachment> CREATOR = new Creator<Attachment>() {
@Override
public Attachment createFromParcel(Parcel source) {
try {
return Attachment.fromString(source.readString());
} catch (Attachment.UnsupportedAttachmentException e) {
throw new RuntimeException(e);
}
}
@Override
public Attachment[] newArray(int size) {
return new Attachment[size];
}
};
View on GitHub (pinned to 157c9d86ac)
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.
Example fix
// before
Attachment att = Attachment.fromString("hybrid");
// after
Attachment att = att.equals("hybrid") ? Attachment.fromString("cross-platform") : Attachment.fromString(att); Defensive patterns
Strategy: validation
Validate before calling
boolean valid = java.util.Arrays.stream(Attachment.values()).anyMatch(a -> a.toString().equals(attachment)); if (!valid) attachment = null; // or substitute "cross-platform"
Try / catch
try { att = Attachment.fromString(value); } catch (UnsupportedAttachmentException e) { att = null; } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Building PublicKeyCredentialCreationOptions/RequestOptions from server JSON that uses newer attachment values; typos like "Platform" (case-sensitive compare) in config or test data.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Transport ${transport} not supported
- Attestation conveyance preference ${attachment} not supporte
- PublicKeyCredentialType ${type} not supported
- User verification requirement ${attachment} not supported
- No response set.
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/b11f042d44eff66e.
Report an issue: GitHub.