Skip to content

Troubleshooting

We can distinguish two types of issues:

Issues Reported by Knip

This indicates a successful run, but there are unused items. Continue with handling issues to deal with unused items reported by Knip.

To better understand why Knip reports what it does, you may want to run it in debug mode by adding --debug to the command:

Terminal window
knip --debug

This will give a lengthy output, including:

  • Included workspaces
  • Used configuration per workspace
  • Enabled plugins per workspace
  • Glob patterns and options followed by matching file paths
  • Plugin config file paths and found dependencies per plugin

Exceptions thrown by Knip

Knip (or one of its plugins loading a configuration file) may throw an error, resulting in an unsuccessful run. You might be encountering a known issue.

Add --debug to the command for more error details to better locate the cause of the error.

Minimal Reproduction

If you encounter an issue or false positives when running Knip, you can open an issue on GitHub. Depending on the type of issue, it may be of great help (or you may be asked) to create a minimal reproduction. This is sometimes referred to as MNWE (minimal not-working example) or MRE (minimal reproducible example).

A convenient way to do so is by forking one of these templates:

Other solutions may work well too, the goal is to have an easy and common understanding and reproduction.

Understanding Knip

Looking to better understand how Knip works? The entry files and plugins explanations cover two core concepts. After this you might want to check out features like production mode and monorepos & workspaces.

In a more general sense, Why use Knip? explains what Knip can do for you.

Ask for Help

If you can’t find your answer in any of the aforementioned resources, feel free to open an issue on GitHub or discuss it in the Discord channel.

ISC License © 2024 Lars Kappert