{"record":{"id":"ab6f923c530b8682","repo":"grpc/grpc-java","slug":"structorerror-geterrordetail","errorCode":null,"errorMessage":"structOrError.getErrorDetail()","messagePattern":"structOrError\\.getErrorDetail\\(\\)","errorType":"validation","errorClass":"ResourceInvalidException","httpStatus":null,"severity":"error","filePath":"xds/src/main/java/io/grpc/xds/XdsClusterResource.java","lineNumber":160,"sourceCode":"                                  ServerInfo serverInfo,\n                                  LoadBalancerRegistry loadBalancerRegistry)\n      throws ResourceInvalidException {\n    StructOrError<CdsUpdate.Builder> structOrError;\n    switch (cluster.getClusterDiscoveryTypeCase()) {\n      case TYPE:\n        structOrError = parseNonAggregateCluster(cluster,\n            certProviderInstances, serverInfo);\n        break;\n      case CLUSTER_TYPE:\n        structOrError = parseAggregateCluster(cluster);\n        break;\n      case CLUSTERDISCOVERYTYPE_NOT_SET:\n      default:\n        throw new ResourceInvalidException(\n            \"Cluster \" + cluster.getName() + \": unspecified cluster discovery type\");\n    }\n    if (structOrError.getErrorDetail() != null) {\n      throw new ResourceInvalidException(structOrError.getErrorDetail());\n    }\n    CdsUpdate.Builder updateBuilder = structOrError.getStruct();\n\n    ImmutableMap<String, ?> lbPolicyConfig = LoadBalancerConfigFactory.newConfig(cluster,\n        enableLeastRequest);\n\n    NameResolver.ConfigOrError configOrError\n        = GracefulSwitchLoadBalancer.parseLoadBalancingPolicyConfig(\n            ImmutableList.of(lbPolicyConfig), loadBalancerRegistry);\n    if (configOrError.getError() != null) {\n      throw new ResourceInvalidException(\n          \"Failed to parse lb config for cluster '\" + cluster.getName() + \"': \"\n          + configOrError.getError());\n    }\n\n    updateBuilder.lbPolicyConfig(configOrError.getConfig(), lbPolicyConfig);\n    updateBuilder.filterMetadata(\n        ImmutableMap.copyOf(cluster.getMetadata().getFilterMetadataMap()));","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/xds/src/main/java/io/grpc/xds/XdsClusterResource.java#L142-L178","documentation":"After resolving the cluster's type-specific parsing, processCluster re-throws any error detail stored in the resulting StructOrError as a ResourceInvalidException. This propagates an error that occurred inside a nested parser (e.g. parseEdsCluster, parseAggregateCluster) up to the CDS resource parse layer.","triggerScenarios":"Any of the per-type parsers (parseNonAggregateCluster, parseAggregateCluster, etc.) return a StructOrError whose errorDetail is non-null, e.g. invalid EDS config, missing load_assignment, bad LRS config.","commonSituations":"EDS cluster missing eds_cluster_config; aggregate cluster with empty/degenerate localities list; unsupported lb policy features for the cluster type.","solutions":["Read the propagated errorDetail message to identify which cluster field the nested parser rejected","Fix the corresponding cluster configuration on the management server","Check grpc-java version support for the control plane's features (e.g. newer cluster fields)"],"exampleFix":"// before\nAggregateCluster.newBuilder().addClusterNames(\"\").build()\n// after\nAggregateCluster.newBuilder().addClusterNames(\"child_cluster_1\").build()","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  cdsUpdate = xdsClusterResource.parseResource(args);\n} catch (ResourceInvalidException e) {\n  // e.getMessage() carries the nested parser's errorDetail; surface it to config owners\n  logger.atWarning().log(\"CDS parse failed: %s\", e.getMessage());\n  nackResource(e.getMessage());\n}","preventionTips":["Keep per-type cluster configs (EDS/aggregate) within gRPC-supported shapes","Read the propagated errorDetail to locate the offending field","Test cluster configs against grpc-java's parser before rollout"],"tags":["grpc","xds","cds","config-validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"64daddc1f3d1975670f769f3e97bde8b2ba32d25","analyzedAt":"2026-09-08T06:14:57.704Z","contentChangedAt":"2026-09-08T06:14:57.704Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}