# filehook error with memoir after update texlive 2019 in Oct 15

After the new LaTeX2e <2019-10-01> version, I got this error:

! Package filehook Error: Detected 'scrlfile' package with unknown definition o f \InputIfFileExists.

It seems related with some definition in KOMA Script, as described here. As instructed I updated Koma from their repository:

tlmgr install --reinstall --repository https://www.komascript.de/repository/texlive/2019 koma-script

But the error persists.

Does somebody knows if there is another package to be updated after the recent changes in LaTeX2e?

EDIT: MWE Added, with the command suggested by @PhelypeOleinik

\PassOptionsToPackage{force}{filehook}
\documentclass[ebook]{memoir}
\usepackage{fontspec}
\usepackage{unicode-math}
\usepackage{xsim}
\begin{document}
Test
\end{document}


\RequirePackage{etoolbox}
\makeatletter
{\expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@empty
\let\CurrentOption\@empty% Anchor point to make sure we're patching     the right place
}{}{}{\errmessage{This patch is no longer necessary}%
\newcommand\gobblesix[6]{}\gobblesix}
{\InputIfFileExists}
{\expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@empty
\InputIfFileExists}{}{\FAILED}
\makeatother
\PassOptionsToPackage{force}{filehook}
\documentclass[ebook]{memoir}
\usepackage{filehook}
\usepackage{fontspec}
\usepackage{unicode-math}
\usepackage{xsim}
\begin{document}
Test
\end{document}


I got this error:

Package filehook Warning: Detected 'scrlfile' package with unknown definition of
\InputIfFileExists.
The 'force' option of 'filehook' is in effect. Macro is overwritten with    default
! on input line 108.

• I use memoir package, maybe there is some inconsistency here, found in log: (/usr/local/texlive/2019/texmf-dist/tex/latex/filehook/filehook.sty Package: filehook 2019/10/03 v0.6 Hooks for input files (/usr/local/texlive/2019/texmf-dist/tex/latex/filehook/filehook-memoir.sty Package: filehook-memoir 2011/01/03 v0.1 filehook patch for memoir class Package filehook Info: Detected 'memoir' class: the memoir hooks will be moved t o the At...OfFiles' hooks on input line 42. )) Oct 21 '19 at 10:43
• Maybe related: tex.stackexchange.com/q/512189. Please add a short minimal working example. Why do you load both packages filehook and scrlfile?
– esdd
Oct 21 '19 at 11:47
• Both scrlfile and filehook were updated to match the LaTeX kernel update in which \InputIfFileExists was changed. However filehook-scrlfile (which is part of filehook) wasn't yet updated to account for the scrlfile update. It's the same problem as here and the workaround, meanwhile filehook isn't updated again, is to use \PassOptionsToPackage{force}{filehook}. Oct 21 '19 at 11:48
• @tatojo Then please post a minimal example. In the question I linked this workaround worked, so it is something particular to your case. Oct 21 '19 at 12:15
• Why is this labeled koma script if you are using memoir? Oct 21 '19 at 13:02

Update 2020-02-04: both memoir and filehook were updated and now this problem shouldn't happen. If it does, please update your TeX distribution.

Here you have two problems at once. The first one was reported here, and is due to a bad timing of setting package hooks. This happens because filehook loads filehook-memoir, and filehook-memoir does \RequirePackage{filehook}, and this makes the option parser go off tracks and report that filehook doesn't have a force option (even though it does).

The issue has already been fixed here and will eventually be updated in the LaTeX format. For now, use this patch (this has to be the very first thing in your document):

\RequirePackage{etoolbox}
\makeatletter
{\expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@empty
\let\CurrentOption\@empty% Anchor point to make sure we're patching the right place
}{}{}{\errmessage{This patch is no longer necessary}%
\newcommand\gobblesix[6]{}\gobblesix}
{\InputIfFileExists}
{\expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@empty
\InputIfFileExists}{}{\FAILED}
\makeatother


After you get that out of the way, just tell filehook to use the force option until memoir is updated (should be soon) and filehook-memoir is updated to match the updated memoir:

\PassOptionsToPackage{force}{filehook}


By the way, the problem doesn't depend on xsim and fontspec, also the problem arises with unicode-math because it eventually loads filehook, so the issue can be narrowed down to:

\PassOptionsToPackage{force}{filehook}
\documentclass{memoir}
\usepackage{filehook}
\begin{document}
\end{document}

• The problem with xsim boils down to a conflict between  filehook and scrlfile. Or rather the fact, that filehook-scrlfile didn't get an update, yet... Oct 22 '19 at 6:33
• @clemens Yes, apparently only the main filehook got an update, and the patches to specific class/packages did not, like scrlfile, as you say, and memoir. Oct 22 '19 at 9:23
• @PhelypeOleinik, got errors, please take a look to the new MWE. Oct 22 '19 at 17:00
• @tatojo It's not an error, it's a warning. Although it's usually a bad idea to ignore those, there's not much you can do until both memoir (Lars is already working on this one) and filehook are updated. You'll have to wait or update local copies of the packages. Oct 22 '19 at 18:30
• @PhelypeOleinik has filehook been updated. Including the memoir support file? Just wanted to test it before releasing an updated memoir Oct 22 '19 at 23:29

Although not a final answer, what allowed me to continue working, and compiling was to place the files filehook.sty, filehook-scrlfile.sty and filehook-memoir.sty @SergioCallegari posted here, in texmf-local/tex/latex/filehook/` and refresh the TeX database.

• I published an update to filehook now, so this workaround is no longer needed. Feb 4 '20 at 7:04
• @MartinScharrer, Well, it looks like everything's okay now. Nice work! Feb 5 '20 at 0:13
• Thanks. Good to get some feedback. Feb 5 '20 at 7:16