Skip to content

[Bug]: Filler list cannot be deleted when referenced by program_play_history #2054

Description

@ryanfaricy

This issue respects the following points:

  • This is a bug, not a question or a configuration issue; Please visit our Discord first to troubleshoot with volunteers, before creating a report.
  • This issue is not already reported on GitHub (I've searched it).
  • I'm using an up to date version of Tunarr; We generally do not support previous older versions. If possible, please update to the latest version before opening an issue.

Description of the bug

A filler list cannot be deleted after it has previously been used for playback, even when it is no longer assigned to any channel.

Deleting the filler list through Library → Filler Lists produces a generic error in the web UI. The useful error is only visible in the container logs:

/api/filler-lists/:id

SqliteError: FOREIGN KEY constraint failed
code: SQLITE_CONSTRAINT_FOREIGNKEY

at Yg.deleteFiller

Database inspection shows that the filler list is no longer present in channel_filler_show, but it is still referenced by historical rows in program_play_history.filler_list_id.

The relevant foreign key is defined with ON DELETE NO ACTION:

FOREIGN KEY (`filler_list_id`)
REFERENCES `filler_show`(`uuid`)
ON UPDATE no action
ON DELETE no action

In this case, 28 playback-history rows referenced the filler list. That historical reference prevented the filler-list record from being deleted.

This appears to be a schema or deletion-transaction issue: deleteFiller does not clear or otherwise handle existing program_play_history.filler_list_id references before deleting the filler list.

Additional database evidence

The filler list had no current channel assignments:

SELECT c.name
FROM channel_filler_show cf
JOIN channel c ON c.uuid = cf.channel_uuid
WHERE cf.filler_show_uuid = '<filler-list-uuid>';

Result:

No rows

However, it still had playback-history references:

SELECT COUNT(*)
FROM program_play_history
WHERE filler_list_id = '<filler-list-uuid>';

Result:

28

Running PRAGMA foreign_key_check; before the attempted deletion returned no existing violations. The failure is caused specifically by the attempted deletion.

No manual database repair was performed.

Reproduction steps

  1. Create a filler list containing one or more programs.
  2. Assign the filler list to a channel.
  3. Play the channel long enough for Tunarr to record filler playback in program_play_history.
  4. Remove the filler list from the channel.
  5. Confirm that the filler list is no longer referenced by channel_filler_show.
  6. Navigate to Library → Filler Lists.
  7. Attempt to delete the previously used filler list.
  8. Confirm the deletion in the dialog.

What is the current bug behavior?

The UI displays a generic deletion error and the filler list remains present.

The backend logs report:

SqliteError: FOREIGN KEY constraint failed
code: SQLITE_CONSTRAINT_FOREIGNKEY

The deletion is blocked because program_play_history.filler_list_id still references the filler list, despite the list no longer being assigned to any channel.

What is the expected correct behavior?

A filler list that is no longer assigned to a channel should be deletable.

Tunarr could handle the historical references in one of these ways:

  1. Set program_play_history.filler_list_id to NULL when the filler list is deleted, preserving the rest of the playback-history record.
  2. Define this relationship using ON DELETE SET NULL.
  3. Explicitly clear the historical filler-list references inside the deleteFiller transaction.

The first or second option would preserve playback history while allowing removal of the filler list.

The UI should also display the underlying constraint error, or explain why deletion is blocked, instead of showing only a generic error.

Tunarr version

Latest

FFMPEG encoder type

Software

Specify full Edge version id

No response

Specify Alpha release number

No response

Specify version number

1.3.13

What browser did you experience the the problem on? Please provide if the issue is related to the Web UI and definitely not the server.

No response

Deployment Type

Docker

What operating system are you using?

macOS Tahoe 26.5.1 (25F80)

Full server logs

### Full relevant server logs


[error]: /api/filler-lists/:id
    err: {
      "type": "SqliteError",
      "message": "FOREIGN KEY constraint failed",
      "stack":
          SqliteError: FOREIGN KEY constraint failed
              at PDe.run (/snapshot/dist/bundle.cjs:1275:12408)
              at QueryPromise.run (/snapshot/dist/bundle.cjs:928:106062)
              at Function.<anonymous> (/snapshot/dist/bundle.cjs:1350:7101)
              at Function.sqliteTransaction (/snapshot/dist/bundle.cjs:57:3087)
              at Hte.transaction (/snapshot/dist/bundle.cjs:1275:11659)
              at ODe.transaction (/snapshot/dist/bundle.cjs:940:18223)
              at Yg.deleteFiller (/snapshot/dist/bundle.cjs:1350:6277)
              at Object.<anonymous> (/snapshot/dist/bundle.cjs:1397:106802)
              at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
      "code": "SQLITE_CONSTRAINT_FOREIGNKEY"
    }

[error]: {"url":"/api/filler-lists/:id"}
    error: {
      "code": "SQLITE_CONSTRAINT_FOREIGNKEY"
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions