PlainError

FileNotFoundError: [Errno 2] No such file or directory: 'config.json'

Last checked 2026-11-11 · 3 fixes · reviewed answer

TL;DRThis Python error happens when code tries to open or read a file named config.json but the file does not exist in the folder the program is running from.

Most likely cause: The config.json file is missing or was never created in the expected folder

Try first: Check if the file exists in the current folder (ls (macOS/Linux) or dir (Windows))

Likely causes

  1. The config.json file is missing or was never created in the expected foldermost likely
  2. The program is looking in the wrong folder because the working directory is different from where the file actually ispossible
  3. A typo in the filename or path inside the codeless likely

How to fix it

Safest first: SafeChanges settingsDangerous
  1. Check if the file exists in the current folderSafe

    Open a terminal or command prompt in the same folder as your script and list the files to see if config.json is present.

    ls (macOS/Linux) or dir (Windows)
  2. Print the current working directory from your codeSafe

    Add a line to print the folder the program thinks it is in so you can compare it to where the file actually lives.

    import os; print(os.getcwd())
  3. Create an empty config.json if it is missingChanges settings

    If the file should exist but does not, create a blank one so the program can at least start, then add the needed settings later.

    touch config.json (macOS/Linux) or echo. > config.json (Windows)

If that didn't fix it

Add code that checks whether config.json exists before trying to open it and prints the full path it is attempting to use

When to see a technician

Contact the developer or someone familiar with the code if you cannot locate or create the missing config file.

Quick answers

What does FileNotFoundError: [Errno 2] No such file or directory: 'config.json' mean?
This Python error happens when code tries to open or read a file named config.json but the file does not exist in the folder the program is running from.
What causes FileNotFoundError: [Errno 2] No such file or directory: 'config.json'?
The config.json file is missing or was never created in the expected folder. (most likely) The program is looking in the wrong folder because the working directory is different from where the file actually is. (possible) A typo in the filename or path inside the code. (less likely)
How do I fix FileNotFoundError: [Errno 2] No such file or directory: 'config.json'?
Try these in order, safest first: 1. Check if the file exists in the current folder. 2. Print the current working directory from your code. 3. Create an empty config.json if it is missing.
What if that didn't fix it?
Add code that checks whether config.json exists before trying to open it and prints the full path it is attempting to use
When should I see a technician?
Contact the developer or someone familiar with the code if you cannot locate or create the missing config file.
Did this fix it? Report a problem

Related errors

All Coding errors →