darktable tags have gotten corrupted

The tags should also be in the XMP files. Normally, if an image is already in the database, the XMP is not read, but:

  • you can remove and re-import the images; that will populate the DB with the data from the XMP;
  • alternatively, at least for now, you can enable the setting that @guille2306 has mentioned (it causes slow start-up, if you have many images, so you should probably turn it off afterwards). Darktable will then update the DB based on the XMP, no need to remove/re-import the photos:

    Once an image has been imported into darktable, the database entries take precedence over the XMP file. Subsequent changes to the XMP file by any other software are not visible to darktable – such changes will be overwritten the next time darktable synchronizes the file. On request, darktable can be configured to search for updated XMP files at startup, offering a choice to update the database or overwrite the XMP file where changes are identified. This configuration can be changed in preferences > storage > xmp.
    (darktable 4.6 user manual - sidecar files)

1 Like