{"record":{"id":"a78a3bc37c240b93","repo":"apache/beam","slug":"azure-credentials-provider-type-name-key-s-not-found","errorCode":null,"errorMessage":"Azure credentials provider type name key '%s' not found","messagePattern":"Azure credentials provider type name key '(.+?)' not found","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/azure/src/main/java/org/apache/beam/sdk/io/azure/options/AzureModule.java","lineNumber":106,"sourceCode":"    public TokenCredential deserialize(JsonParser jsonParser, DeserializationContext context)\n        throws IOException {\n      return context.readValue(jsonParser, TokenCredential.class);\n    }\n\n    @Override\n    public TokenCredential deserializeWithType(\n        JsonParser jsonParser, DeserializationContext context, TypeDeserializer typeDeserializer)\n        throws IOException {\n      Map<String, String> asMap =\n          jsonParser.readValueAs(new TypeReference<Map<String, String>>() {});\n      if (asMap == null) {\n        throw new IOException(\"Azure credentials provider could not be read.\");\n      }\n\n      String typeNameKey = typeDeserializer.getPropertyName();\n      String typeName = asMap.get(typeNameKey);\n      if (typeName == null) {\n        throw new IOException(\n            String.format(\"Azure credentials provider type name key '%s' not found\", typeNameKey));\n      }\n\n      if (typeName.equals(DefaultAzureCredential.class.getSimpleName())) {\n        return new DefaultAzureCredentialBuilder().build();\n      } else if (typeName.equals(ClientSecretCredential.class.getSimpleName())) {\n        return new ClientSecretCredentialBuilder()\n            .clientId(asMap.getOrDefault(AZURE_CLIENT_ID, \"\"))\n            .clientSecret(asMap.getOrDefault(AZURE_CLIENT_SECRET, \"\"))\n            .tenantId(asMap.getOrDefault(AZURE_TENANT_ID, \"\"))\n            .build();\n      } else if (typeName.equals(ManagedIdentityCredential.class.getSimpleName())) {\n        return new ManagedIdentityCredentialBuilder()\n            .clientId(asMap.getOrDefault(AZURE_CLIENT_ID, \"\"))\n            .build();\n      } else if (typeName.equals(EnvironmentCredential.class.getSimpleName())) {\n        return new EnvironmentCredentialBuilder().build();\n      } else if (typeName.equals(ClientCertificateCredential.class.getSimpleName())) {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/azure/src/main/java/org/apache/beam/sdk/io/azure/options/AzureModule.java#L88-L124","documentation":"deserializeWithType looks up the type-discriminator property (from typeDeserializer.getPropertyName()) in the parsed map to decide which TokenCredential subclass to rebuild. If that key is absent, it throws IOException \"Azure credentials provider type name key '%s' not found\" — the serialized payload lacks the @class/type marker the module needs.","triggerScenarios":"Deserializing a credential JSON object that omits the type-name property (e.g. hand-crafted JSON, or a payload written by a serializer without the type suffix); key-name mismatch between serializer versions.","commonSituations":"Manually constructing credential JSON in pipeline templates; payloads from a different Jackson setup (no default typing) that dropped the discriminator; editing serialized options and accidentally deleting the type field.","solutions":["Serialize credentials only through AzureModule so the type-discriminator field is written; do not hand-craft the JSON.","Add the expected type-name property (e.g. \"@class\": \"DefaultAzureCredential\") to the payload.","Confirm the same AzureModule/type-deserializer configuration is used on both write and read sides.","If migrating, re-serialize the credential from a live TokenCredential object instead of patching old JSON."],"exampleFix":"// before\n{\"clientId\":\"...\",\"tenantId\":\"...\"} // missing type key\n// after\n{\"@class\":\"ClientSecretCredential\",\"clientId\":\"...\",\"tenantId\":\"...\"}","handlingStrategy":"validation","validationCode":"if (!payload.containsKey(\"@class\")) { // or the configured type property name\n  throw new IllegalArgumentException(\"credential JSON missing type discriminator\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  return deserialize(json);\n} catch (IOException e) {\n  if (e.getMessage().contains(\"type name key\")) {\n    LOG.error(\"credential payload lacks the type discriminator; re-serialize via AzureModule\");\n  }\n  throw e;\n}","preventionTips":["Only produce credential JSON through AzureModule/Jackson, never by hand","Keep the type-discriminator property intact when editing templates","Use identical serializer config on write and read sides","Re-serialize from a live TokenCredential instead of patching old payloads"],"tags":["java","jackson","deserialization","azure-credentials","type-discriminator"],"backgroundTag":"json-unmarshal-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}