Skip to content

Troubleshooting

Each entry is a symptom someone has actually met in this guide's lab, what was really happening, and the check that separates the two.

"My file is missing from the output"

Three filters can take a file out before it is counted (chapter 2). Work them in order: is the name hidden (a leading dot — --hidden lets it in)? Is it named by an ignore file (chapter 8's switches bring it back, one family at a time)? Or did the detector never claim it — run with -v and look for Unknown extension (chapter 5). If none of the three speaks, the file's extension belongs to a different language than the one in your head, and --languages shows whose it is.

"The total changed and I didn't edit anything"

You changed the conditions, not the files. The usual causes, all demonstrated: the folder became a git repository, so its .gitignore woke up (chapter 8); you ran from a different folder, so a different tokei.toml — or none — applied (chapter 10); hidden files were let in or out by a flag. Recount under pinned conditions, as chapter 11 prescribes, before suspecting the tool.

"Markdown shows zero code"

That is the prose rule working (chapter 4): Markdown's own lines are comments. The code is in the children — fenced blocks reported as embedded languages. If the children are missing too, you may be looking at a --compact view, which folds them out of sight while still counting them (chapter 7).

"My .gitignore is being ignored"

Is the folder actually a git repository? A .gitignore outside one is inert — the lab's flags/repo counted its "ignored" file happily until git init gave the rules a home (chapter 8). Inside a repository and still ignored? Check for a --no-ignore-vcs in your command, or a no_ignore_vcs line in the tokei.toml you are standing in.

"Tokei and cloc disagree about my project"

They disagree about a definition, and the per-file view will find it: pick the file with the biggest gap and read both counts against it. The frequent culprits are docstrings (cloc counts Python's as comments; tokei's default says code — chapter 7), prose files, and embedded languages. Once the rule is named, the disagreement is arithmetic again.

"Tokei refuses the output format I asked for"

Your build was compiled without it. The --version line lists the formats this binary has; the error message names the feature flag that adds yours (chapter 9). Rebuild with the flag, or take the JSON and convert it downstream.

"I saved a count and -i won't give it back"

Known, and reproduced in the lab: in 15.0.0 as built here, -i left every table unchanged, and from an empty folder printed zeros instead of the saved counts (chapter 9). Keep the JSON file itself as the record; recount when you need a table.

"A huge file counts as almost nothing"

Lines are the unit. A minified bundle, a generated data file, an export saved as one line — each is one line, however many megabytes it holds. If size in bytes is the question, du and wc -c are the honest tools; tokei counts the shape of text, and a wall of text on one line has almost no shape.