apache/beam · error · RuntimeException
Error when parsing input schema file:
Error message
Error when parsing input schema file:
What it means
FileReadSchemaTransformProvider.resolveSchemaStringOrFilePath loads the schema from either the inline schema string or a schema file path via FileSystems. When reading the schema file raises an IOException (file missing, unreadable, network filesystem failure), it is wrapped in a RuntimeException with this message. It means the transform could not obtain the row schema needed to parse input files.
Solutions
- Verify the schema file path/URI is correct and the file exists
- Check read permissions for the pipeline runner's service account on the file/bucket
- Test FileSystems.open with the same URI in a small job or via gsutil/s3 cmd
- If the schema is small, inline it in the configuration's schema string instead of a path
- Confirm the matching filesystem is registered (gcs-connector/hadoop-fs dependencies)
Example fix
// before
.withSchema("gs://my-bucket/schemas/missing.json")
// after
.withSchema("gs://my-bucket/schemas/user.json") // or inline: "{\"fields\":[...]}" Defensive patterns
Strategy: validation
Validate before calling
MatchResult res = FileSystems.match(schemaPath);
if (res.metadata().size() != 1)
throw new IllegalArgumentException("Expected exactly 1 schema file at " + schemaPath
+ ", got " + res.metadata().size()); Try / catch
try {
apply(FileReadSchemaTransformProvider...);
} catch (RuntimeException e) {
if (e.getMessage().startsWith("Error when parsing input schema file"))
LOG.error("Check schema path/permissions: {}", e.getCause());
throw e;
} Prevention
- Assert the schema file exists with FileSystems.match before running the pipeline
- Inline small schemas in the config string to avoid file I/O entirely
- Grant the runner service account read access to the schema location
When it happens
Trigger: FileReadSchemaTransformConfiguration with schema set to a file path (e.g. 'gs://bucket/schema.json') where the path doesn't match any file, matches multiple files, or FileSystems.open fails (permission/network error).
Common situations: Wrong GCS/S3/local path; bucket permissions for the pipeline service account; schema file deleted between config authoring and run; ambiguous glob matching more than one file (fails earlier with its own message).
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Cannot find Spanner table.
- Cannot merge schemas with different numbers of fields…
- Cannot merge two types: +fieldType1.getTypeName()+ and…
- Config schema provided with the expansion request
- Converting to Beam schema type is not supported
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/d405b576f36941a3.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/io/file-schema-transform/src/main/java/org/apache/beam/sdk/io/fileschematransform/FileReadSchemaTransformProvider.java:222
return schema;
}
checkArgument(
!result.metadata().isEmpty(),
"Failed to match any files for the input schema file path.");
List<ResourceId> resource =
result.metadata().stream()
.map(MatchResult.Metadata::resourceId)
.collect(Collectors.toList());
checkArgument(
resource.size() == 1,
"Expected exactly 1 schema file, but got " + resource.size() + " files.");
ReadableByteChannel byteChannel = FileSystems.open(resource.get(0));
Reader reader = Channels.newReader(byteChannel, UTF_8.name());
return CharStreams.toString(reader);
} catch (IOException e) {
throw new RuntimeException("Error when parsing input schema file: ", e);
}
}
private FileReadSchemaTransformFormatProvider getProvider() {
String format = configuration.getFormat();
Map<String, FileReadSchemaTransformFormatProvider> providers =
Providers.loadProviders(FileReadSchemaTransformFormatProvider.class);
checkArgument(
providers.containsKey(format),
String.format(
"Received unsupported file format: %s. Supported formats are %s",
format, providers.keySet()));
Optional<FileReadSchemaTransformFormatProvider> provider =
Optional.ofNullable(providers.get(format));
checkState(provider.isPresent());
return provider.get();
}View on GitHub (pinned to 12126d8942)