{"record":{"id":"97e0489e8a4e9e0f","repo":"apache/iceberg","slug":"unknown-content-type","errorCode":null,"errorMessage":"Unknown content type ","messagePattern":"Unknown content type ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/FileMetadata.java","lineNumber":289,"sourceCode":"            referencedDataFile != null, \"Referenced data file is required for DV\");\n      } else {\n        Preconditions.checkArgument(contentOffset == null, \"Content offset can only be set for DV\");\n        Preconditions.checkArgument(\n            contentSizeInBytes == null, \"Content size can only be set for DV\");\n      }\n\n      switch (content) {\n        case POSITION_DELETES:\n          Preconditions.checkArgument(\n              sortOrderId == null, \"Position delete file should not have sort order\");\n          break;\n        case EQUALITY_DELETES:\n          if (sortOrderId == null) {\n            sortOrderId = SortOrder.unsorted().orderId();\n          }\n          break;\n        default:\n          throw new IllegalStateException(\"Unknown content type \" + content);\n      }\n\n      return new GenericDeleteFile(\n          specId,\n          content,\n          filePath,\n          format,\n          isPartitioned ? DataFiles.copy(spec, partitionData) : null,\n          fileSizeInBytes,\n          new Metrics(\n              recordCount,\n              columnSizes,\n              valueCounts,\n              nullValueCounts,\n              nanValueCounts,\n              lowerBounds,\n              upperBounds,\n              avgValueSizes,","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/FileMetadata.java#L271-L307","documentation":"FileMetadata.Builder.build only handles POSITION_DELETES, EQUALITY_DELETES (and DV-equivalent) content types when defaulting sortOrderId; a content type it does not recognize reaches the default branch and throws IllegalStateException('Unknown content type ' + content). This means the builder was handed a FileContent value that is not a supported delete content type — e.g. DATA (0) passed to a delete-file builder.","triggerScenarios":"Calling FileMetadata.deleteBuilder(spec).withContent(...) with an unsupported/legacy content enum value, or build() invoked with content left as DATA/null in a delete builder after a code path forgot to set the content type.","commonSituations":"Custom metadata generators/repair tools writing manifest entries directly; copy code that copies a data file's content type into a delete builder; reading manifests written by a newer spec with unknown FileContent values using an older Iceberg reader.","solutions":["Ensure the delete builder's content is set explicitly withContent(FileContent.POSITION_DELETES) or EQUALITY_DELETES and never copied from a data file.","If reading manifests produced by a newer Iceberg, upgrade the reader to a version that supports the new FileContent value.","Check custom writers/metadata repair scripts for default content values (DATA=0) leaking into delete-file builders."],"exampleFix":"// before: content copied from a data file\ndeleteBuilder.withContent(dataFile.content()).withPath(...); // DATA -> throws\n// after: set the delete content type explicitly\ndeleteBuilder.withContent(FileContent.POSITION_DELETES).withPath(...);","handlingStrategy":"validation","validationCode":"Preconditions.checkArgument(\n    content == FileContent.POSITION_DELETES || content == FileContent.EQUALITY_DELETES,\n    \"Delete builder requires a delete content type, got: %s\", content);","typeGuard":"boolean isDeleteContent(FileContent c) {\n  return c == FileContent.POSITION_DELETES || c == FileContent.EQUALITY_DELETES;\n}","tryCatchPattern":"try {\n  DeleteFile df = builder.build();\n} catch (IllegalStateException e) {\n  if (e.getMessage().startsWith(\"Unknown content type\")) {\n    // fix the builder call: set withContent(POSITION_DELETES | EQUALITY_DELETES)\n  } else throw e;\n}","preventionTips":["Always set content explicitly on delete builders; never copy from data files.","Upgrade readers before consuming manifests written by newer Iceberg/spec versions.","Audit custom metadata writers for default FileContent.DATA leaking into delete paths."],"tags":["file-metadata","enum","content-type","builder"],"backgroundTag":"invalid-enum-value","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"}