We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG] 1.9.1 OCR output mode "none" is not valid
### Description

Very similar to #1643 

Updating via portainer, and with the following ENV:

PAPERLESS_OCR_CLEAN=none

the startup of the web server goes into a loop (see logs below).



### Steps to reproduce

1. Set PAPERLESS_OCR_CLEAN=none (from 1.8.0 install)
2. Update docker via portainer to latest paperless-ngx
3. Start container

### Webserver logs

```bash
Paperless-ngx docker container starting...
Creating directory /tmp/paperless
Adjusting permissions of paperless files. This may take a while.
Waiting for PostgreSQL to start...
Waiting for Redis...
Connected to Redis broker.
Apply database migrations...
SystemCheckError: System check identified some issues:
ERRORS:
?: OCR clean mode "none" is not valid
```


### Paperless-ngx version

1.9.1

### Host OS

Raspberry Pi 4B

### Installation method

Docker - official image

### Browser

Firefox

### Configuration changes

_No response_

### Other

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/paperless/checks.py`
Content:
```
1 import grp
2 import os
3 import pwd
4 import shutil
5 import stat
6 
7 from django.conf import settings
8 from django.core.checks import Error
9 from django.core.checks import register
10 from django.core.checks import Warning
11 
12 exists_message = "{} is set but doesn't exist."
13 exists_hint = "Create a directory at {}"
14 writeable_message = "{} is not writeable"
15 writeable_hint = (
16     "Set the permissions of {} to be writeable by the user running the "
17     "Paperless services"
18 )
19 
20 
21 def path_check(var, directory):
22     messages = []
23     if directory:
24         if not os.path.isdir(directory):
25             messages.append(
26                 Error(exists_message.format(var), exists_hint.format(directory)),
27             )
28         else:
29             test_file = os.path.join(
30                 directory,
31                 f"__paperless_write_test_{os.getpid()}__",
32             )
33             try:
34                 with open(test_file, "w"):
35                     pass
36             except PermissionError:
37                 dir_stat = os.stat(directory)
38                 dir_mode = stat.filemode(dir_stat.st_mode)
39                 dir_owner = pwd.getpwuid(dir_stat.st_uid).pw_name
40                 dir_group = grp.getgrgid(dir_stat.st_gid).gr_name
41                 messages.append(
42                     Error(
43                         writeable_message.format(var),
44                         writeable_hint.format(
45                             f"\n{dir_mode} {dir_owner} {dir_group} " f"{directory}\n",
46                         ),
47                     ),
48                 )
49             finally:
50                 if os.path.isfile(test_file):
51                     os.remove(test_file)
52 
53     return messages
54 
55 
56 @register()
57 def paths_check(app_configs, **kwargs):
58     """
59     Check the various paths for existence, readability and writeability
60     """
61 
62     return (
63         path_check("PAPERLESS_DATA_DIR", settings.DATA_DIR)
64         + path_check("PAPERLESS_TRASH_DIR", settings.TRASH_DIR)
65         + path_check("PAPERLESS_MEDIA_ROOT", settings.MEDIA_ROOT)
66         + path_check("PAPERLESS_CONSUMPTION_DIR", settings.CONSUMPTION_DIR)
67     )
68 
69 
70 @register()
71 def binaries_check(app_configs, **kwargs):
72     """
73     Paperless requires the existence of a few binaries, so we do some checks
74     for those here.
75     """
76 
77     error = "Paperless can't find {}. Without it, consumption is impossible."
78     hint = "Either it's not in your ${PATH} or it's not installed."
79 
80     binaries = (settings.CONVERT_BINARY, "tesseract")
81 
82     check_messages = []
83     for binary in binaries:
84         if shutil.which(binary) is None:
85             check_messages.append(Warning(error.format(binary), hint))
86 
87     return check_messages
88 
89 
90 @register()
91 def debug_mode_check(app_configs, **kwargs):
92     if settings.DEBUG:
93         return [
94             Warning(
95                 "DEBUG mode is enabled. Disable Debug mode. This is a serious "
96                 "security issue, since it puts security overides in place which "
97                 "are meant to be only used during development. This "
98                 "also means that paperless will tell anyone various "
99                 "debugging information when something goes wrong.",
100             ),
101         ]
102     else:
103         return []
104 
105 
106 @register()
107 def settings_values_check(app_configs, **kwargs):
108     """
109     Validates at least some of the user provided settings
110     """
111 
112     def _ocrmypdf_settings_check():
113         """
114         Validates some of the arguments which will be provided to ocrmypdf
115         against the valid options.  Use "ocrmypdf --help" to see the valid
116         inputs
117         """
118         msgs = []
119         if settings.OCR_OUTPUT_TYPE not in {
120             "pdfa",
121             "pdf",
122             "pdfa-1",
123             "pdfa-2",
124             "pdfa-3",
125         }:
126             msgs.append(
127                 Error(f'OCR output type "{settings.OCR_OUTPUT_TYPE}" is not valid'),
128             )
129 
130         if settings.OCR_MODE not in {"force", "skip", "redo", "skip_noarchive"}:
131             msgs.append(Error(f'OCR output mode "{settings.OCR_MODE}" is not valid'))
132 
133         if settings.OCR_CLEAN not in {"clean", "clean-final"}:
134             msgs.append(Error(f'OCR clean mode "{settings.OCR_CLEAN}" is not valid'))
135         return msgs
136 
137     def _timezone_validate():
138         """
139         Validates the user provided timezone is a valid timezone
140         """
141         try:
142             import zoneinfo
143         except ImportError:  # pragma: nocover
144             import backports.zoneinfo as zoneinfo
145         msgs = []
146         if settings.TIME_ZONE not in zoneinfo.available_timezones():
147             msgs.append(
148                 Error(f'Timezone "{settings.TIME_ZONE}" is not a valid timezone'),
149             )
150         return msgs
151 
152     return _ocrmypdf_settings_check() + _timezone_validate()
153
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/paperless/checks.py b/src/paperless/checks.py
--- a/src/paperless/checks.py
+++ b/src/paperless/checks.py
@@ -130,7 +130,7 @@
         if settings.OCR_MODE not in {"force", "skip", "redo", "skip_noarchive"}:
             msgs.append(Error(f'OCR output mode "{settings.OCR_MODE}" is not valid'))
 
-        if settings.OCR_CLEAN not in {"clean", "clean-final"}:
+        if settings.OCR_CLEAN not in {"clean", "clean-final", "none"}:
             msgs.append(Error(f'OCR clean mode "{settings.OCR_CLEAN}" is not valid'))
         return msgs

{"golden_diff": "diff --git a/src/paperless/checks.py b/src/paperless/checks.py\n--- a/src/paperless/checks.py\n+++ b/src/paperless/checks.py\n@@ -130,7 +130,7 @@\n         if settings.OCR_MODE not in {\"force\", \"skip\", \"redo\", \"skip_noarchive\"}:\n             msgs.append(Error(f'OCR output mode \"{settings.OCR_MODE}\" is not valid'))\n \n-        if settings.OCR_CLEAN not in {\"clean\", \"clean-final\"}:\n+        if settings.OCR_CLEAN not in {\"clean\", \"clean-final\", \"none\"}:\n             msgs.append(Error(f'OCR clean mode \"{settings.OCR_CLEAN}\" is not valid'))\n         return msgs\n", "issue": "[BUG] 1.9.1 OCR output mode \"none\" is not valid\n### Description\n\nVery similar to #1643 \r\n\r\nUpdating via portainer, and with the following ENV:\r\n\r\nPAPERLESS_OCR_CLEAN=none\r\n\r\nthe startup of the web server goes into a loop (see logs below).\r\n\r\n\n\n### Steps to reproduce\n\n1. Set PAPERLESS_OCR_CLEAN=none (from 1.8.0 install)\r\n2. Update docker via portainer to latest paperless-ngx\r\n3. Start container\n\n### Webserver logs\n\n```bash\nPaperless-ngx docker container starting...\r\nCreating directory /tmp/paperless\r\nAdjusting permissions of paperless files. This may take a while.\r\nWaiting for PostgreSQL to start...\r\nWaiting for Redis...\r\nConnected to Redis broker.\r\nApply database migrations...\r\nSystemCheckError: System check identified some issues:\r\nERRORS:\r\n?: OCR clean mode \"none\" is not valid\n```\n\n\n### Paperless-ngx version\n\n1.9.1\n\n### Host OS\n\nRaspberry Pi 4B\n\n### Installation method\n\nDocker - official image\n\n### Browser\n\nFirefox\n\n### Configuration changes\n\n_No response_\n\n### Other\n\n_No response_\n", "before_files": [{"content": "import grp\nimport os\nimport pwd\nimport shutil\nimport stat\n\nfrom django.conf import settings\nfrom django.core.checks import Error\nfrom django.core.checks import register\nfrom django.core.checks import Warning\n\nexists_message = \"{} is set but doesn't exist.\"\nexists_hint = \"Create a directory at {}\"\nwriteable_message = \"{} is not writeable\"\nwriteable_hint = (\n    \"Set the permissions of {} to be writeable by the user running the \"\n    \"Paperless services\"\n)\n\n\ndef path_check(var, directory):\n    messages = []\n    if directory:\n        if not os.path.isdir(directory):\n            messages.append(\n                Error(exists_message.format(var), exists_hint.format(directory)),\n            )\n        else:\n            test_file = os.path.join(\n                directory,\n                f\"__paperless_write_test_{os.getpid()}__\",\n            )\n            try:\n                with open(test_file, \"w\"):\n                    pass\n            except PermissionError:\n                dir_stat = os.stat(directory)\n                dir_mode = stat.filemode(dir_stat.st_mode)\n                dir_owner = pwd.getpwuid(dir_stat.st_uid).pw_name\n                dir_group = grp.getgrgid(dir_stat.st_gid).gr_name\n                messages.append(\n                    Error(\n                        writeable_message.format(var),\n                        writeable_hint.format(\n                            f\"\\n{dir_mode} {dir_owner} {dir_group} \" f\"{directory}\\n\",\n                        ),\n                    ),\n                )\n            finally:\n                if os.path.isfile(test_file):\n                    os.remove(test_file)\n\n    return messages\n\n\n@register()\ndef paths_check(app_configs, **kwargs):\n    \"\"\"\n    Check the various paths for existence, readability and writeability\n    \"\"\"\n\n    return (\n        path_check(\"PAPERLESS_DATA_DIR\", settings.DATA_DIR)\n        + path_check(\"PAPERLESS_TRASH_DIR\", settings.TRASH_DIR)\n        + path_check(\"PAPERLESS_MEDIA_ROOT\", settings.MEDIA_ROOT)\n        + path_check(\"PAPERLESS_CONSUMPTION_DIR\", settings.CONSUMPTION_DIR)\n    )\n\n\n@register()\ndef binaries_check(app_configs, **kwargs):\n    \"\"\"\n    Paperless requires the existence of a few binaries, so we do some checks\n    for those here.\n    \"\"\"\n\n    error = \"Paperless can't find {}. Without it, consumption is impossible.\"\n    hint = \"Either it's not in your ${PATH} or it's not installed.\"\n\n    binaries = (settings.CONVERT_BINARY, \"tesseract\")\n\n    check_messages = []\n    for binary in binaries:\n        if shutil.which(binary) is None:\n            check_messages.append(Warning(error.format(binary), hint))\n\n    return check_messages\n\n\n@register()\ndef debug_mode_check(app_configs, **kwargs):\n    if settings.DEBUG:\n        return [\n            Warning(\n                \"DEBUG mode is enabled. Disable Debug mode. This is a serious \"\n                \"security issue, since it puts security overides in place which \"\n                \"are meant to be only used during development. This \"\n                \"also means that paperless will tell anyone various \"\n                \"debugging information when something goes wrong.\",\n            ),\n        ]\n    else:\n        return []\n\n\n@register()\ndef settings_values_check(app_configs, **kwargs):\n    \"\"\"\n    Validates at least some of the user provided settings\n    \"\"\"\n\n    def _ocrmypdf_settings_check():\n        \"\"\"\n        Validates some of the arguments which will be provided to ocrmypdf\n        against the valid options.  Use \"ocrmypdf --help\" to see the valid\n        inputs\n        \"\"\"\n        msgs = []\n        if settings.OCR_OUTPUT_TYPE not in {\n            \"pdfa\",\n            \"pdf\",\n            \"pdfa-1\",\n            \"pdfa-2\",\n            \"pdfa-3\",\n        }:\n            msgs.append(\n                Error(f'OCR output type \"{settings.OCR_OUTPUT_TYPE}\" is not valid'),\n            )\n\n        if settings.OCR_MODE not in {\"force\", \"skip\", \"redo\", \"skip_noarchive\"}:\n            msgs.append(Error(f'OCR output mode \"{settings.OCR_MODE}\" is not valid'))\n\n        if settings.OCR_CLEAN not in {\"clean\", \"clean-final\"}:\n            msgs.append(Error(f'OCR clean mode \"{settings.OCR_CLEAN}\" is not valid'))\n        return msgs\n\n    def _timezone_validate():\n        \"\"\"\n        Validates the user provided timezone is a valid timezone\n        \"\"\"\n        try:\n            import zoneinfo\n        except ImportError:  # pragma: nocover\n            import backports.zoneinfo as zoneinfo\n        msgs = []\n        if settings.TIME_ZONE not in zoneinfo.available_timezones():\n            msgs.append(\n                Error(f'Timezone \"{settings.TIME_ZONE}\" is not a valid timezone'),\n            )\n        return msgs\n\n    return _ocrmypdf_settings_check() + _timezone_validate()\n", "path": "src/paperless/checks.py"}], "after_files": [{"content": "import grp\nimport os\nimport pwd\nimport shutil\nimport stat\n\nfrom django.conf import settings\nfrom django.core.checks import Error\nfrom django.core.checks import register\nfrom django.core.checks import Warning\n\nexists_message = \"{} is set but doesn't exist.\"\nexists_hint = \"Create a directory at {}\"\nwriteable_message = \"{} is not writeable\"\nwriteable_hint = (\n    \"Set the permissions of {} to be writeable by the user running the \"\n    \"Paperless services\"\n)\n\n\ndef path_check(var, directory):\n    messages = []\n    if directory:\n        if not os.path.isdir(directory):\n            messages.append(\n                Error(exists_message.format(var), exists_hint.format(directory)),\n            )\n        else:\n            test_file = os.path.join(\n                directory,\n                f\"__paperless_write_test_{os.getpid()}__\",\n            )\n            try:\n                with open(test_file, \"w\"):\n                    pass\n            except PermissionError:\n                dir_stat = os.stat(directory)\n                dir_mode = stat.filemode(dir_stat.st_mode)\n                dir_owner = pwd.getpwuid(dir_stat.st_uid).pw_name\n                dir_group = grp.getgrgid(dir_stat.st_gid).gr_name\n                messages.append(\n                    Error(\n                        writeable_message.format(var),\n                        writeable_hint.format(\n                            f\"\\n{dir_mode} {dir_owner} {dir_group} \" f\"{directory}\\n\",\n                        ),\n                    ),\n                )\n            finally:\n                if os.path.isfile(test_file):\n                    os.remove(test_file)\n\n    return messages\n\n\n@register()\ndef paths_check(app_configs, **kwargs):\n    \"\"\"\n    Check the various paths for existence, readability and writeability\n    \"\"\"\n\n    return (\n        path_check(\"PAPERLESS_DATA_DIR\", settings.DATA_DIR)\n        + path_check(\"PAPERLESS_TRASH_DIR\", settings.TRASH_DIR)\n        + path_check(\"PAPERLESS_MEDIA_ROOT\", settings.MEDIA_ROOT)\n        + path_check(\"PAPERLESS_CONSUMPTION_DIR\", settings.CONSUMPTION_DIR)\n    )\n\n\n@register()\ndef binaries_check(app_configs, **kwargs):\n    \"\"\"\n    Paperless requires the existence of a few binaries, so we do some checks\n    for those here.\n    \"\"\"\n\n    error = \"Paperless can't find {}. Without it, consumption is impossible.\"\n    hint = \"Either it's not in your ${PATH} or it's not installed.\"\n\n    binaries = (settings.CONVERT_BINARY, \"tesseract\")\n\n    check_messages = []\n    for binary in binaries:\n        if shutil.which(binary) is None:\n            check_messages.append(Warning(error.format(binary), hint))\n\n    return check_messages\n\n\n@register()\ndef debug_mode_check(app_configs, **kwargs):\n    if settings.DEBUG:\n        return [\n            Warning(\n                \"DEBUG mode is enabled. Disable Debug mode. This is a serious \"\n                \"security issue, since it puts security overides in place which \"\n                \"are meant to be only used during development. This \"\n                \"also means that paperless will tell anyone various \"\n                \"debugging information when something goes wrong.\",\n            ),\n        ]\n    else:\n        return []\n\n\n@register()\ndef settings_values_check(app_configs, **kwargs):\n    \"\"\"\n    Validates at least some of the user provided settings\n    \"\"\"\n\n    def _ocrmypdf_settings_check():\n        \"\"\"\n        Validates some of the arguments which will be provided to ocrmypdf\n        against the valid options.  Use \"ocrmypdf --help\" to see the valid\n        inputs\n        \"\"\"\n        msgs = []\n        if settings.OCR_OUTPUT_TYPE not in {\n            \"pdfa\",\n            \"pdf\",\n            \"pdfa-1\",\n            \"pdfa-2\",\n            \"pdfa-3\",\n        }:\n            msgs.append(\n                Error(f'OCR output type \"{settings.OCR_OUTPUT_TYPE}\" is not valid'),\n            )\n\n        if settings.OCR_MODE not in {\"force\", \"skip\", \"redo\", \"skip_noarchive\"}:\n            msgs.append(Error(f'OCR output mode \"{settings.OCR_MODE}\" is not valid'))\n\n        if settings.OCR_CLEAN not in {\"clean\", \"clean-final\", \"none\"}:\n            msgs.append(Error(f'OCR clean mode \"{settings.OCR_CLEAN}\" is not valid'))\n        return msgs\n\n    def _timezone_validate():\n        \"\"\"\n        Validates the user provided timezone is a valid timezone\n        \"\"\"\n        try:\n            import zoneinfo\n        except ImportError:  # pragma: nocover\n            import backports.zoneinfo as zoneinfo\n        msgs = []\n        if settings.TIME_ZONE not in zoneinfo.available_timezones():\n            msgs.append(\n                Error(f'Timezone \"{settings.TIME_ZONE}\" is not a valid timezone'),\n            )\n        return msgs\n\n    return _ocrmypdf_settings_check() + _timezone_validate()\n", "path": "src/paperless/checks.py"}]}