{"record":{"id":"0745e8344966a79d","repo":"apache/beam","slug":"you-must-include-a-descriptorpath-or-a-proto-schema-but-not","errorCode":null,"errorMessage":"You must include a descriptorPath or a proto Schema but not both.","messagePattern":"You must include a descriptorPath or a proto Schema but not both\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaWriteSchemaTransformProvider.java","lineNumber":220,"sourceCode":"        if (numFields != 1) {\n          throw new IllegalArgumentException(\"Expecting exactly one field, found \" + numFields);\n        }\n        if (!inputSchema.getField(0).getType().equals(Schema.FieldType.BYTES)) {\n          throw new IllegalArgumentException(\n              \"The input schema must have exactly one field of type byte.\");\n        }\n        toBytesFn = getRowToRawBytesFunction(inputSchema.getField(0).getName());\n      } else if (configuration.getFormat().equals(\"JSON\")) {\n        toBytesFn = JsonUtils.getRowToJsonBytesFunction(inputSchema);\n      } else if (configuration.getFormat().equals(\"PROTO\")) {\n        String descriptorPath = configuration.getFileDescriptorPath();\n        String schema = configuration.getSchema();\n        String messageName = configuration.getMessageName();\n        if (messageName == null) {\n          throw new IllegalArgumentException(\"Expecting messageName to be non-null.\");\n        }\n        if (descriptorPath != null && schema != null) {\n          throw new IllegalArgumentException(\n              \"You must include a descriptorPath or a proto Schema but not both.\");\n        } else if (descriptorPath != null) {\n          toBytesFn = ProtoByteUtils.getRowToProtoBytes(descriptorPath, messageName);\n        } else if (schema != null) {\n          toBytesFn = ProtoByteUtils.getRowToProtoBytesFromSchema(schema, messageName);\n        } else {\n          throw new IllegalArgumentException(\n              \"At least a descriptorPath or a proto Schema is required.\");\n        }\n      } else {\n        if (configuration.getProducerConfigUpdates() != null\n            && configuration.getProducerConfigUpdates().containsKey(\"schema.registry.url\")) {\n          toGenericRecordsFn = AvroUtils.getRowToGenericRecordFunction(avroSchema);\n          toBytesFn = null;\n        } else {\n          toBytesFn = AvroUtils.getRowToAvroBytesFunction(inputSchema);\n        }\n      }","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaWriteSchemaTransformProvider.java#L202-L238","documentation":"KafkaWriteSchemaTransformProvider (PROTO format) requires the proto message to be described exactly one way: either via a file descriptorPath or an inline proto Schema. Supplying both at once makes the intended source ambiguous, so expand() throws this IllegalArgumentException as an input validation guard.","triggerScenarios":"Thrown at sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaWriteSchemaTransformProvider.java:220 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide only one of fileDescriptorPath or schema in the transform configuration.","Clear the other field so exactly one descriptor source remains."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}