{"record":{"id":"7f4755d6f693679b","repo":"grpc/grpc-java","slug":"the-entry-value-is-of-type-value-getclass","errorCode":null,"errorMessage":"The entry '${value}' is of type '${value.getClass()}', which is not supported","messagePattern":"The entry '(.+?)' is of type '(.+?)', which is not supported","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/grpc/internal/ManagedChannelImplBuilder.java","lineNumber":656,"sourceCode":"  }\n\n  private static List<?> checkListEntryTypes(List<?> list) {\n    List<Object> parsedList = new ArrayList<>(list.size());\n    for (Object value : list) {\n      if (value == null) {\n        parsedList.add(null);\n      } else if (value instanceof Map) {\n        parsedList.add(checkMapEntryTypes((Map<?, ?>) value));\n      } else if (value instanceof List) {\n        parsedList.add(checkListEntryTypes((List<?>) value));\n      } else if (value instanceof String) {\n        parsedList.add(value);\n      } else if (value instanceof Number) {\n        parsedList.add(((Number) value).doubleValue());\n      } else if (value instanceof Boolean) {\n        parsedList.add(value);\n      } else {\n        throw new IllegalArgumentException(\n            \"The entry '\" + value + \"' is of type '\" + value.getClass()\n                + \"', which is not supported\");\n      }\n    }\n    return Collections.unmodifiableList(parsedList);\n  }\n\n  @Override\n  public <X> ManagedChannelImplBuilder setNameResolverArg(NameResolver.Args.Key<X> key, X value) {\n    if (nameResolverCustomArgs == null) {\n      nameResolverCustomArgs = new IdentityHashMap<>();\n    }\n    nameResolverCustomArgs.put(checkNotNull(key, \"key\"), checkNotNull(value, \"value\"));\n    return this;\n  }\n\n  @SuppressWarnings(\"unchecked\") // This cast is safe because of setNameResolverArg()'s signature.\n  void copyAllNameResolverCustomArgsTo(NameResolver.Args.Builder dest) {","sourceCodeStart":638,"sourceCodeEnd":674,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/core/src/main/java/io/grpc/internal/ManagedChannelImplBuilder.java#L638-L674","documentation":"The list-parsing counterpart of the map check: elements of config lists are normalized to String, Double, or Boolean, and any other element type causes this IllegalArgumentException reporting the element and its class. It guards the internal channel builder against unsupported config shapes.","triggerScenarios":"Supplying a config/option List containing nested Lists, Maps, or arbitrary objects where only scalar String/Number/Boolean entries are accepted.","commonSituations":"Programmatically built method-config lists with nested objects; YAML/JSON parse trees (Map/List nodes) passed through unconverted instead of scalars.","solutions":["Replace nested entries with supported scalar types (String, Number, Boolean).","Convert parsed JSON/YAML trees into flat scalar lists before passing them in.","Inspect the reported value/class and coerce accordingly (e.g. ((Number) v).doubleValue())."],"exampleFix":"// before\nList<Object> cfg = Arrays.asList(\"a\", Collections.singletonMap(\"k\", 1));\n// after\nList<Object> cfg = Arrays.asList(\"a\", \"k=1\");","handlingStrategy":"validation","validationCode":"static void checkListEntries(List<Object> cfg) {\n  for (Object v : cfg) {\n    if (!(v instanceof String || v instanceof Number || v instanceof Boolean)) {\n      throw new IllegalArgumentException(\"list entry '\" + v + \"' of type \" + v.getClass() + \" unsupported\");\n    }\n  }\n}","typeGuard":"boolean isScalarEntry(Object v) {\n  return v instanceof String || v instanceof Number || v instanceof Boolean;\n}","tryCatchPattern":"try {\n  applyConfig(list);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"which is not supported\")) {\n    log.error(\"Unsupported config list entry: {}\", e.getMessage());\n  } else throw e;\n}","preventionTips":["Flatten nested JSON/YAML structures into scalar lists before handing to the builder.","Coerce numbers explicitly with ((Number) v).doubleValue() where needed.","Validate config lists in a unit test covering all supported config keys."],"tags":["grpc","config","type-mismatch","validation"],"backgroundTag":"config-type-mismatch","analyzedSha":"64daddc1f3d1975670f769f3e97bde8b2ba32d25","analyzedAt":"2026-09-08T06:14:57.704Z","contentChangedAt":"2026-09-08T06:14:57.704Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}