{"record":{"id":"be431f4be08249f6","repo":"apache/beam","slug":"service-endpoint-must-be-a-uri-got-s-be431f","errorCode":null,"errorMessage":"Service endpoint must be a URI, got: %s","messagePattern":"Service endpoint must be a URI, got: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/kinesis/KinesisWriteSchemaTransformProvider.java","lineNumber":183,"sourceCode":"    public PCollectionRowTuple expand(PCollectionRowTuple input) {\n      PCollection<Row> inputRows = input.getSinglePCollection();\n      Schema schema = inputRows.getSchema();\n\n      final int dataFieldIndex = resolveDataFieldIndex(schema);\n      final boolean dataIsString = isStringField(schema, dataFieldIndex);\n      final Integer partitionKeyIndex =\n          schema.hasField(\"partition_key\") ? schema.indexOf(\"partition_key\") : null;\n\n      AwsBasicCredentials creds =\n          AwsBasicCredentials.create(config.getAwsAccessKey(), config.getAwsSecretKey());\n      StaticCredentialsProvider provider = StaticCredentialsProvider.create(creds);\n\n      @Nullable URI endpoint = null;\n      if (config.getServiceEndpoint() != null) {\n        try {\n          endpoint = new URI(config.getServiceEndpoint());\n        } catch (URISyntaxException ex) {\n          throw new IllegalArgumentException(\n              String.format(\"Service endpoint must be a URI, got: %s\", config.getServiceEndpoint()),\n              ex);\n        }\n      }\n\n      boolean verifyCertificate =\n          config.getVerifyCertificate() == null || config.getVerifyCertificate();\n\n      SerializableFunction<KV<String, byte[]>, byte[]> serializer = KV::getValue;\n      KinesisIO.Write<KV<String, byte[]>> writeTransform =\n          KinesisIO.<KV<String, byte[]>>write()\n              .withStreamName(config.getStreamName())\n              .withClientConfiguration(\n                  ClientConfiguration.builder()\n                      .credentialsProvider(provider)\n                      .region(Region.of(config.getRegion()))\n                      .endpoint(endpoint)\n                      .skipCertificateVerification(!verifyCertificate)","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/kinesis/KinesisWriteSchemaTransformProvider.java#L165-L201","documentation":"KinesisWriteSchemaTransformProvider.expand parses config.getServiceEndpoint() with new URI(...); a URISyntaxException is wrapped as an IllegalArgumentException including the bad value. Applies to the Kinesis write schema transform (YAML pipeline).","triggerScenarios":"service_endpoint in a Kinesis write YAML config that is not valid URI syntax (no scheme, illegal chars, spaces).","commonSituations":"Missing https://; localstack endpoint without scheme; templated env var left unresolved like ${KINESIS_ENDPOINT}.","solutions":["Provide a full URI: https://kinesis.region.amazonaws.com or http://localhost:4566 for localstack","Pre-validate with new URI(value) or a regex for scheme://host:port","Unset service_endpoint to use the AWS default"],"exampleFix":"// before\nservice_endpoint: \"${KINESIS_ENDPOINT}\"\n// after\nservice_endpoint: https://kinesis.us-east-1.amazonaws.com","handlingStrategy":"validation","validationCode":"try { new URI(config.getServiceEndpoint()); } catch (URISyntaxException e) { throw new IllegalArgumentException(\"bad service_endpoint\", e); }","typeGuard":"boolean validEndpoint(String s){ try { new URI(s); return true; } catch (Exception e){ return false; } }","tryCatchPattern":"try { expand(cfg); } catch (IllegalArgumentException e) { fix endpoint scheme/syntax in YAML; resubmit; }","preventionTips":["Always include https:// (or http:// for local emulators)","Resolve env/template placeholders before submission","Trim whitespace from endpoint values"],"tags":["kinesis","uri","config","schema-transform"],"backgroundTag":"invalid-url-format","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"}