Skip to content

Keep a File Out of DeleteInvalidFiles When a Tool Did Not Run #1088

Closed

Description

@ptr727

Behavior

A process step that fails because its tool did not run is handled as if the media had failed. With DeleteInvalidFiles on, the abort path in Process.ProcessFile() then deletes the file through DeleteFailedFile(), although nothing showed the media to be bad.

DeleteFailedFile() keeps the file only when the first media stream verify in VerifyAndRepair() returns VerifyResult.ToolError. These sites still read a tool that did not run as a failure:

  1. A re-verify inside the repair ladder. TryRemuxRepair(), RepairAndReVerify() and TryLosslessTimestampRepair() accept a re-verify only when it is Clean, so a ToolError there fails the repair. VerifyAndRepair() or RepairTimestampsAndSetState() then sets VerifyFailed and RepairFailed. The re-verify does not update _lastVerifyResult, so DeleteFailedFile() still reads the first verify's DecodeError or TimestampOnly and deletes the file.
  2. Every other tool step. A media props read through Refresh() and MediaProps.GetMediaProps(), a remux, and a re-encode each return false when FfProbe, MkvMerge, MediaInfo, FfMpeg or HandBrake fails to launch. The file aborts and is deleted.
  3. A repair tool that does not run. MkvMerge, FfMpeg or HandBrake failing to launch inside the repair ladder fails the repair, which sets RepairFailed the same way.

Reproduction shape

  1. Set Verify: true, AutoRepair: true and DeleteInvalidFiles: true.
  2. Process a file whose first verify returns DecodeError.
  3. Make FfMpeg fail to start before the repair ladder's re-verify, for example because a resource limit blocks process creation.
  4. The file is marked VerifyFailed and RepairFailed and is deleted, although the repaired output was never checked.

Expected

A step whose tool did not run fails the file as a tool error. It sets neither VerifyFailed nor RepairFailed, and never leads to a delete. One signal for "a tool did not run" reaching DeleteFailedFile() covers every site, rather than one guard per step.

Found while fixing the first-verify case of this class, ARCHITECTURE.md "Process Command Logic", suspect branch S16.

Activity

  1. added
    bug
    pre-existing
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpre-existing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions