{"record":{"id":"cda77f4ac0a127ec","repo":"microg/GmsCore","slug":"publickeycredentialtype-type-not-supported","errorCode":null,"errorMessage":"PublicKeyCredentialType ${type} not supported","messagePattern":"PublicKeyCredentialType (.+?) not supported","errorType":"exception","errorClass":"PublicKeyCredentialType.UnsupportedPublicKeyCredTypeException","httpStatus":null,"severity":"error","filePath":"play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/PublicKeyCredentialType.java","lineNumber":51,"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 PublicKeyCredentialType fromString(String type) throws UnsupportedPublicKeyCredTypeException {\n        for (PublicKeyCredentialType value : values()) {\n            if (value.value.equals(type)) return value;\n        }\n        throw new UnsupportedPublicKeyCredTypeException(\"PublicKeyCredentialType \" + type + \" not supported\");\n    }\n\n    public static Creator<PublicKeyCredentialType> CREATOR = new Creator<PublicKeyCredentialType>() {\n        @Override\n        public PublicKeyCredentialType createFromParcel(Parcel source) {\n            try {\n                return PublicKeyCredentialType.fromString(source.readString());\n            } catch (UnsupportedPublicKeyCredTypeException e) {\n                throw new RuntimeException(e);\n            }\n        }\n\n        @Override\n        public PublicKeyCredentialType[] newArray(int size) {\n            return new PublicKeyCredentialType[size];\n        }\n    };\n","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/PublicKeyCredentialType.java#L33-L69","documentation":"PublicKeyCredentialType.fromString() maps a credential type string (\"public-key\") to the enum; any other value throws UnsupportedPublicKeyCredTypeException. WebAuthn currently defines only \"public-key\", so this fires on typos or future/unknown type identifiers.","triggerScenarios":"Calling fromString with anything but \"public-key\": e.g. \"Public-Key\" (case-sensitive), \"webauthn\", \"\", or a JSON credential object whose \"type\" field is missing/garbled.","commonSituations":"Malformed JSON from a relying-party server; test fixtures with wrong case; future credential types emitted by newer authenticators that this library predates.","solutions":["Use exactly \"public-key\" for the type field.","Validate the type string against PublicKeyCredentialType values before calling fromString.","Filter out credential entries with unknown types before parsing each one."],"exampleFix":"// before\nvar type = PublicKeyCredentialType.fromString(json.getString(\"type\"));\n// after\nString t = json.optString(\"type\", \"public-key\");\nvar type = \"public-key\".equals(t) ? PublicKeyCredentialType.fromString(t) : null;","handlingStrategy":"try-catch","validationCode":"boolean valid = \"public-key\".equals(typeStr);","typeGuard":null,"tryCatchPattern":"try { type = PublicKeyCredentialType.fromString(t); } catch (UnsupportedPublicKeyCredTypeException e) { skipCredential(); }","preventionTips":["Always emit \"public-key\" as the credential type.","Skip rather than parse credential entries whose type differs.","Remember the comparison is case-sensitive."],"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"}