LaTeX error · Packages, files and fonts
I can't find file `chapter1'
Quick answer
TeX tried to open a file and it was not there. In a LaTeX document this usually comes from \input chapter1 without braces, or from a path or name that does not match the actual file: a different folder, wrong capitalisation, a space in the name or a missing extension. Check that the file exists relative to the main .tex file and write \input{chapters/chapter1}. The message also appears when the compiler is given a file name that does not exist.
The error in the log
This is how the message appears in the .log file (and in the compile output). The line starting with l. is the line number where TeX noticed the problem; the real mistake is there or just before it.
! I can't find file `chapter1'.
l.3 \input chapter1
*** (job aborted, file error in nonstop mode)Why it happens
- The file is missing or in another folder: paths in
\inputare relative to the main file, not to the file containing the command. - The name differs in case or spelling (Linux servers and online editors are case-sensitive:
Chapter1.texis notchapter1.tex). - A file name with spaces or special characters, which TeX reads only up to the space.
- The compiler was started on a file name that does not exist, for example the wrong main file in the project settings.
How to fix it
Make the file exist where LaTeX looks for it, and refer to it with braces and the path from the main file: \input{chapters/chapter1}. Rename files to avoid spaces.
In the example below filecontents writes chapter1.tex so the snippet is self-contained; in a real project it is a separate file next to the main one.
Broken: reproduces the error
\documentclass{article}
\begin{document}
\input chapter1
\end{document}Try this in Octree — free LaTeX editor with AI, compiles in your browser
Fixed: compiles cleanly
\begin{filecontents*}[overwrite]{chapter1.tex}
This is the first chapter.
\end{filecontents*}
\documentclass{article}
\begin{document}
\input{chapter1}
\end{document}Related errors
- File not found – A package or class named in
\usepackageor\documentclassis misspelled or not installed. - Emergency stop – The run was aborted; the reason is in the line after it or in the error just above.
- Missing \begin{document} – Something printable sits in the preamble, before
\begin{document}. - All LaTeX errors and warnings – The full list, grouped by cause
Frequently Asked Questions
What is the difference between this and "File not found"?
"I can't find file" is the low-level TeX message, printed when the primitive \input or the compiler cannot open a file. "LaTeX Error: File `x' not found" is LaTeX's own message for \usepackage, \documentclass and braced \input{...}.
Should I use \input or \include?
\input{file} inserts the file exactly where it is, anywhere in the document. \include{file} starts a new page and works with \includeonly to compile selected chapters. Both need the file to exist under that path.
Why does it work on my computer but not online?
Online editors usually run on Linux, where file names are case-sensitive, and only see the files you uploaded. Check the capitalisation and that every input file is part of the project.
Paste your document into Octree — compile errors get a Fix with AI button
When a compile fails, Octree shows the error next to the line that caused it and offers a one-click fix that you can review before applying. Free, nothing to install.
Fix it in Octree →