File Repair (CPP-027)

CPP-IdentifierCPP-027
CPP-LabelFile Repair
AuthorBertrand Caron
ContributorsJohan Kylander
EvaluatorsFelix Burger, Maria Benauer, Matthew Addis
Change historyComments
Version 1.0.0 - 2025-08-29Milestone version
Version 1.1.0 - 2026-03-27Migration to XML

1. Description of the CPP

As a way of handling validation errors or rendering errors, the TDA corrects structural issues identified in its Files.

Inputs and outputs

Input(s)
Data
File
sometimes: Representation, whose format structures are causing issues during validation, rendering or use
Metadata
Properties of source File or Representation
Documentation/guidance
Preservation action registry
Format specifications
Output(s)
Data
File or Representation whose format structures are deemed “fixed” and/or File or Representation whose erroneous format structures are considered acceptable after further investigation
Metadata
Properties of target File or Representation
New/updated File or Representation properties
Provenance metadata
Optional File comparison between source and target File / Representation.
Documentation/guidance
Optional Updated Preservation action registry

Definition and scope

File Repair is an operation performed to correct erroneous format structures that could prevent the expected use or rendering of the File by the repository or the user. For additional considerations on the topic, see this conference paper. In addition, erroneous format structures can potentially hinder preservation actions, such as file format migration, as tools developed to process the Files expect the Files to have a defined structure.

Erroneous format structures have many different causes. Some examples are listed below:

  • Improper behaviours of creation software (e.g. InDesign, in some previous versions, was known to export corrupted PDFs);
  • Partial or failed transfers (e.g. digital photographs transferred through an unstable bluetooth connection);
  • Corruption or loss when data is transferred to a TDA or is processed within a TDA where there are no ‘good’ copies of the data that can be recovered from and hence file repair is necessary (e.g. a File is corrupted during transfer to a TDA which goes undetected or a File is corrupted during ingest and is then replicated across all copies held by the TDA).
  • Edition with a different software than the creation tool (e.g. PDFs produced with pdfTeX, then edited with Quark XPress);
  • etc.

The impact of the erroneous format structures should be assessed as “low”, “medium” or, “high” according to the following criticality / severity criteria:

  • Impact is considered “High” when important parts of the File’s or Representation’s content are not accessible;
  • Impact is considered “Medium” when a regular feature of the File or Representation is not supported, either for the consumer or the TDA (e.g. if metadata extraction cannot be performed);
  • Impact is considered “Low” when no effect can be detected on the File’s or Representation’s content or features.

A File or Representation might be affected by several deviations from the standard. In that case, the impact should be assessed for each identified deviation. The process should then try to address issues from the most to the least impactful. One should keep in mind that errors might be related, so that one repairing operations might affect several errors returned by a validation tool. In addition, some tools would stop the validation process at the first error, so that repairing the initial error returned by the tool would lead to a still invalid File for another reason.

This CPP covers the following steps:

  • The initial analysis step that first determines precisely which erroneous format structure is responsible for the failure using validation tools and metadata extractors, and then evaluates the risk that these structures pose for current and future users;
  • The intervention on the File itself;
  • The control step that measures the impact of repair, and controls that no significant properties were affected in the process;
  • The documentation step that records the details of the process;
  • The handling of false positives and identification of gaps in the tools producing the false positive warnings / errors.

Many reasons could cause the process not to be effectively performed. In the description below, three are mentioned:

  • The impact of erroneous structures is deemed low compared to the Object value and the operation’s complexity;
  • The deviation from the standard could not be assessed;
  • A repair method could not be provided by CPP-012 (Risk Mitigation).

In any of these cases, the file repair process would end and another error-handling option among the ones suggested in CPP-010 (File Format Validation) should be considered.

File repair is a manual and investigative process that requires in-depth knowledge of format structures. Therefore, its performance requires a high level of institutional maturity and organisational resources in digital preservation and is recommended only for mature TDAs.

Process description

Trigger event(s)

Trigger EventCPP-identifier
Error or warning returned by the validation processCPP-010 (File Format Validation)
Failed attempt to render or use in any way
Corrupted File or Representation, no intact copy availableCPP-004 (Data Corruption Management)
The file repair process may end up with a situation where the File cannot be repaired. In such cases, disposal is required by the file repair process.CPP-017 (Disposal)

Step-by-step description

NoSupplierInputStepsOutputCustomer
 sequence
1Observation of failure to render or use a File or RepresentationUse rendering tools and edition tools to check whether the erroneous format structures impact the File’s content and featuresEffect on the File’s content and features
Source File or Representation
Any software that takes the format as input, in particular rendering tools
2Error messageIf Format validation has returned that the File is invalid, check whether knowledge bases on validation errors already have assessed the erroneous format structures’ impactImpact as assessed by external resources
Literature or knowledge bases on validation errors. An example of such a knowledge base is the JHOVE wiki that associates an impact assessment and remediation suggestion.
3Knowledge gathered in the previous step(s)Evaluate current impact of erroneous format structures (low, middle, high…) against significant properties. For example, if the erroneous format structure affects the Image Unique Identifier (EXIF tag) and that the presence of internal technical metadata is not deemed significant by the TDA, the impact will be deemed low.If the impact is evaluated as “low”, consider not proceeding further.Risk impact
CPP-022 (Significant Properties Definition)Significant properties
4Data: source File / RepresentationUse different validation tools and metadata extractors to identify precisely which format structures are responsible for the detected issueErrors and warnings
CPP-010 (File Format Validation)Tools: as many validation tools as possible; as a default, reference parsing tools associated with the formatSource File or Representation properties
CPP-009 (Metadata Extraction)Tools: metadata extractors
5Errors and warningsCompare with format specifications to determine the distance between erroneous File structures and specification requirementsEstimated deviation from the specification
Format specifications
6If there is no deviation, consider contributing to improvement of software (rendering, validation, etc.) that returned the false positive, and do not proceed further.If the deviation from the standard cannot be assessed, consider not proceeding further.Issues / contributions to tools
7Errors and warningsRevise results of step 1 in light of outputs of steps 2 and 3, then go to step 6Revised risk impact
Source File or Representation properties
Estimated deviation from the specification
8Revised impact level and consequenceDecide whether or not to perform file repair
9CPP-012 (Risk Mitigation)Preservation action registryRequest a repair method.If no repair method is available, consider not proceeding furtherRepair method
10Tool: edition tool / hexadecimal editorPerform chosen repair methodTarget File or Representation
11Data: Target File or RepresentationDocument in the Provenance Information the creation of a new Representation. Trigger new AIP Version.Run metadata extraction and file format validation on the target File or Representation
CPP-009 (Metadata Extraction)
CPP-010 (File Format Validation)
Tools: metadata extractors and validation tools used in step 2Target File or Representation properties
12Target File or Representation properties (in particular validity status)Control that the target File or Representation has expected validity status and significant properties.If the File or Representation is still invalid, assess the outcome of the repair method:
  • If the repair method was successful (i.e., fixed indeed an erroneous format structure), resume the process from step 1 with the target File or Representation;
  • If the repair method was unsuccessful, resume the process from step 7 with the source File or Representation
Decision whether the repair method should be confirmed
CPP-022 (Significant Properties Definition)Significant properties
13Decide which File or Representation should be retained (source, target or both).If target File or Representation is to be retained, proceed with further steps. If not, the process ends
14Document precisely the nature of the operation performed (tool and version used, date, options or command-line arguments, etc.)New Provenance metadata
15Optional: Update the Preservation action registry with the new process descriptionNew or updated repair methodCPP-012 (Risk Mitigation)

Rationale(s) and worst case(s)

RationaleImpact of inaction or failure of the process
Erroneous format structures can cause rendering issues or prevent expected use of the File or Representation.In order to decide whether to perform the repair method, TDA should weigh the impact and likelihood of the risk against the Information Object value, the operation complexity and available knowledge of its staff.Potentially, inability to render the File. See Caron, Bertrand. “‘Validation OK’ They Said: Fixing the Rendering of a So-Called Valid PDF.” Open Preservation Foundation (blog), May 21, 2025.
If the TDA is performing format validation, having defined procedures to handle errors by investigating their cause and correcting structures is necessary as a proper response. It is recommended that a TDA maintains an institutional Preservation Actions Registry that includes common validation errors and potential solutions to fix them.Without comparative support, the know-how or the resources required to manage the investigation process and repair actions can get lost, resulting in Files either remaining invalid and at a risk of being preserved properly, or not even ingested at all.

2. Dependencies and relationships with other CPPs

Dependencies

CPP-IDCPP-TitleRelationship description
CPP-010File Format ValidationValidation is generally implemented as part of an ingest workflow. If validation fails, a decision can be taken to ingest the File or Representation as is, reject it or repair the erroneous structures.
CPP-012Risk MitigationRisk Mitigation, as the provider of all actions aiming at limiting the impact or likelihood of identified risks, is intended to prescribe appropriate methods to repair the File or Representation.
CPP-022Significant Properties DefinitionModifying the File’s Bitstream in order to correct faulty structures can cause unexpected changes to the rendering and behaviour of an Object. Thus file repair should also be evaluated based on significant properties.

Other relations

RelationCPP-IDCPP-TitleRelationship description
May requireCPP-005Identifier ManagementA repaired File may get a new identifier.
May requireCPP-009Metadata ExtractionTools extracting properties of the File or Representation are useful, if not necessary, for analysing which format structures are erroneous.
Required byCPP-013Object Management ReportingFixing invalid Files produces Provenance metadata and data for quality reporting to the stakeholders
Affinity withCPP-014File MigrationBoth operations affect the Files’ Bitstream and aim at reducing the risk. Migration is typically performed to mitigate an obsolescence risk, while repair handles format structure issues.
Alternative toCPP-004Data Corruption ManagementIn some cases where no intact copy of corrupted or broken data is available, repairing the structure of an altered copy is the only option.

4. Reference implementations

Use cases

Improperly formatted dates in a PDF

Institutional background
InstitutionLeibniz Information Centre for Science and Technology, Germany, DE
HyperlinkLindlar, Micky. “A Date with PDF-HUL-133 ‘Improperly Formed Date.’” Open Preservation Foundation (blog), May 13, 2024. https://openpreservation.org/blogs/a-date-with-pdf-hul-133-improperly-formed-date/
Description
Trigger eventA PDF File that was to be ingested was analyzed by TIB and errors were returned by validation tools (JHOVE, pdfcpu and qpdf).
Problem statementThe creation and modification dates are incorrectly formatted, and as a consequence rendering tools cannot display these dates in their metadata panel.
Proposed solutionAfter analysing the formatting issue and comparing it to the expected format from the specification, TIB compared two different repair methods, applied them and compared the result between source and target Files. The final decision was to retain only the source format, as the risk associated with this format structure issue was deemed low.

Repairing a PDF that causes Rendering Issues in Adobe Reader

Institutional background
InstitutionTIB – Leibniz Information Centre for Science and Technology and University Library, Germany, DE
HyperlinkCaron, Bertrand. “‘Validation OK’ They Said: Fixing the Rendering of a So-Called Valid PDF.” Open Preservation Foundation (blog), May 21, 2025. https://openpreservation.org/blogs/validation-ok-they-said-fixing-the-rendering-of-a-so-called-valid-pdf/.
Description
Trigger eventA PDF File that was to be ingested was identified by TIB could not be displayed by Adobe Reader.
Problem statementThe analysis used validation tools to identify the erroneous format structure: very high values for integers, for some properties where smaller values were expected by the rendering tools.
Proposed solutionThough no deviation was noticed from the specification, TIB considered the risk as high as Adobe Reader is the default rendering tool for PDFs.After performing the repair, significant properties (textual content, visual aspect) were checked with the tool comparepdf to confirm that no important information or feature was lost in the process. After noticing that the process caused the loss of unreferenced PDF objects (undisplayed but potentially meaningful pieces of information located in the PDF file) that were considered as a significant property, the repair method was corrected.The decision was to retain only the repaired File.

Publicly available documentation

InstitutionOrganisation typeLanguageHyperlink
TIB – Leibniz Information Centre for Science and Technology and University Library, DENational library
Non-commercial digital preservation service
Research infrastructure
Research performing organisation
English https://wiki.tib.eu/confluence/spaces/lza/pages/93608641/Preservation+Management#PreservationManagement-Migration
English https://wiki.tib.eu/confluence/spaces/lza/pages/93608618/Ingest?preview=/93608618/310285406/mets-deposit.png#Ingest-PAIProcessdiagrammMETSdeposit
(File Repair is part of all ingest routines after validation stack process)
English https://wiki.tib.eu/confluence/spaces/lza/pages/93608618/Ingest?preview=/93608618/310285408/oai_deposit.png#Ingest-OAIDpsProcessdiagrammOAI-PMHdeposit