{"record":{"id":"783fec0a6f7bf2fc","repo":"apache/beam","slug":"unknown-mode-mode","errorCode":null,"errorMessage":"Unknown mode: \" + mode","messagePattern":"Unknown mode: \" \\+ mode","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSource.java","lineNumber":436,"sourceCode":"    super.validate();\n    switch (mode) {\n      case FILEPATTERN:\n        checkArgument(\n            getStartOffset() == 0,\n            \"FileBasedSource is based on a file pattern or a full single file \"\n                + \"but the starting offset proposed %s is not zero\",\n            getStartOffset());\n        checkArgument(\n            getEndOffset() == Long.MAX_VALUE,\n            \"FileBasedSource is based on a file pattern or a full single file \"\n                + \"but the ending offset proposed %s is not Long.MAX_VALUE\",\n            getEndOffset());\n        break;\n      case SINGLE_FILE_OR_SUBRANGE:\n        // Nothing more to validate.\n        break;\n      default:\n        throw new IllegalStateException(\"Unknown mode: \" + mode);\n    }\n  }\n\n  @Override\n  public final long getMaxEndOffset(PipelineOptions options) throws IOException {\n    checkArgument(\n        mode != Mode.FILEPATTERN, \"Cannot determine the exact end offset of a file pattern\");\n    Metadata metadata = getSingleFileMetadata();\n    return metadata.sizeBytes();\n  }\n\n  /**\n   * A {@link Source.Reader reader} that implements code common to readers of {@code\n   * FileBasedSource}s.\n   *\n   * <h2>Seekability</h2>\n   *\n   * <p>This reader uses a {@link ReadableByteChannel} created for the file represented by the","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSource.java#L418-L454","documentation":"FileBasedSource.validate() throws IllegalStateException when the source's Mode is neither FILEPATTERN nor SINGLE_FILE_OR_SUBRANGE. validate() runs before reader creation (createReader calls it), so this aborts pipeline execution when the source's mode is corrupted or unrecognized.","triggerScenarios":"Creating a reader for a FileBasedSource whose mode is an unrecognized value — typically SDK version skew between the job-submission graph and worker deserialization, or a subclass violating the mode contract.","commonSituations":"Same as 195: mixed Beam versions across client/workers, stale serialized pipelines, or custom FileBasedSource subclasses misusing the mode field.","solutions":["Align Beam SDK versions across client and workers.","Resubmit a freshly built pipeline.","If subclassing FileBasedSource, only use Mode.FILEPATTERN or Mode.SINGLE_FILE_OR_SUBRANGE."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use Mode only via FileBasedSource's public constructors; never assign it directly in subclasses.","Align SDK versions across submission and execution environments."],"tags":["java","apache-beam","internal-state","version-skew"],"backgroundTag":"invalid-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}