It would be better to have a message here to describe assertion failure, for example:

    assert(fileNameSet.contains(fname), s"Missing file name $fname")