{"record":{"id":"a98ca866c5fec54a","repo":"apache/iceberg","slug":"cannot-serialize-an-eager-input-file-location","errorCode":null,"errorMessage":"Cannot serialize an eager input file: <location>","messagePattern":"Cannot serialize an eager input file: <location>","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/io/EagerInputFile.java","lineNumber":116,"sourceCode":"\n    EagerInputFileConfigurable(InputFile delegate, long length) {\n      super(delegate, length);\n      Preconditions.checkArgument(\n          delegate instanceof HadoopConfigurable,\n          \"Cannot create Hadoop Configurable Eager Input File because %s does not implement HadoopConfigurable\",\n          delegate.getClass().getName());\n      this.delegate = (HadoopConfigurable) delegate;\n    }\n\n    @Override\n    public Configuration getConf() {\n      return delegate.getConf();\n    }\n\n    @Override\n    public void serializeConfWith(\n        Function<Configuration, SerializableSupplier<Configuration>> confSerializer) {\n      throw new UnsupportedOperationException(\n          \"Cannot serialize an eager input file: \" + location());\n    }\n  }\n}\n","sourceCodeStart":98,"sourceCodeEnd":121,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/io/EagerInputFile.java#L98-L121","documentation":"EagerInputFile cannot serialize a Hadoop Configuration supplier because the eager wrapper does not preserve the delegate's configurable behavior. Calling serializeConfWith on the EagerInputFileConfigurable subclass throws UnsupportedOperationException to prevent broken serialization when shipping the input file to a remote task.","triggerScenarios":"Calling serializeConfWith(Function<Configuration, SerializableSupplier<Configuration>>) on an eager input file instance, typically in code paths that prepare Hadoop-backed FileIO for serialization to executors.","commonSituations":"Distributing an eagerly-cached InputFile with Spark/Flink that was wrapped from a HadoopInputFile; framework code unconditionally calling serializeConfWith on all input files.","solutions":["Use the delegate (original HadoopInputFile) for serialization instead of the eager wrapper.","Avoid wrapping in EagerInputFile before the serializeConfWith step.","Extract needed configuration eagerly and pass a SerializableSupplier yourself.","If this is framework-internal, gate the call with instanceof checks."],"exampleFix":"// before\nfile.serializeConfWith(conf -> () -> conf); // UnsupportedOperationException on eager file\n// after\nif (file instanceof EagerInputFile) {\n  delegateInputFile.serializeConfWith(conf -> () -> conf);\n} else {\n  file.serializeConfWith(conf -> () -> conf);\n}","handlingStrategy":"type-guard","validationCode":"boolean serializable = !(inputFile instanceof EagerInputFile);\nif (!serializable) { unwrapAndUseDelegate(inputFile); }","typeGuard":"static InputFile serializableInputFile(InputFile f) {\n  if (f instanceof EagerInputFile) {\n    throw new UnsupportedOperationException(\"Use the delegate for serialization\");\n  }\n  return f;\n}","tryCatchPattern":"try {\n  file.serializeConfWith(supplier);\n} catch (UnsupportedOperationException e) {\n  delegateOf(file).serializeConfWith(supplier);\n}","preventionTips":["Keep a reference to the original InputFile before wrapping in EagerInputFile","Apply serializeConfWith before eager caching in framework code","Gate with instanceof EagerInputFile when handling arbitrary InputFiles","Don't distribute eager wrappers across task boundaries"],"tags":["unsupported-operation","serialization","hadoop"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}