record_problems <- function(x, label, path = NULL) {
  probs <- problems(x)
  if (nrow(probs) == 0) {
    return(invisible())
  }

  cli::cli_inform(
    "{nrow(probs)} problem{?s} in parsing the {label} table."
  )

  problem_dir <- here::here("..", "problems")
  problem_path <- path(problem_dir, label, ext = "csv")
  dir_create(problem_dir)

  if (!is.null(path)) {
    probs$file <- path
  }

  write_csv(probs, problem_path, append = file_exists(problem_path))
}
