We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
unclear validation error with dataset_description.json
A couple people have posted asking why their datasets could not be read (through fmriprep or mriqc), since the error message did not indicate which file was not formatted correctly.

example error message
```
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
```

- example 1: https://neurostars.org/t/fmriprep1-2-3-jsondecode-error-expecting-value/3352
- example 2: https://neurostars.org/t/week-8-quiz-question-10/18410

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `bids/layout/validation.py`
Content:
```
1 """Functionality related to validation of BIDSLayouts and BIDS projects."""
2 
3 import os
4 import json
5 import re
6 import warnings
7 
8 from ..utils import listify
9 from ..exceptions import BIDSValidationError, BIDSDerivativesValidationError
10 
11 
12 MANDATORY_BIDS_FIELDS = {
13     "Name": {"Name": "Example dataset"},
14     "BIDSVersion": {"BIDSVersion": "1.0.2"},
15 }
16 
17 
18 MANDATORY_DERIVATIVES_FIELDS = {
19     **MANDATORY_BIDS_FIELDS,
20     "PipelineDescription.Name": {
21         "PipelineDescription": {"Name": "Example pipeline"}
22     },
23 }
24 
25 EXAMPLE_BIDS_DESCRIPTION = {
26     k: val[k] for val in MANDATORY_BIDS_FIELDS.values() for k in val}
27 
28 
29 EXAMPLE_DERIVATIVES_DESCRIPTION = {
30     k: val[k] for val in MANDATORY_DERIVATIVES_FIELDS.values() for k in val}
31 
32 
33 DEFAULT_LOCATIONS_TO_IGNORE = ("code", "stimuli", "sourcedata", "models",
34                                re.compile(r'^\.'))
35 
36 def absolute_path_deprecation_warning():
37     warnings.warn("The absolute_paths argument will be removed from PyBIDS "
38                   "in 0.14. You can easily access the relative path of "
39                   "BIDSFile objects via the .relpath attribute (instead of "
40                   ".path). Switching to this pattern is strongly encouraged, "
41                   "as the current implementation of relative path handling "
42                   "is known to produce query failures in certain edge cases.")
43 
44 
45 def indexer_arg_deprecation_warning():
46     warnings.warn("The ability to pass arguments to BIDSLayout that control "
47                   "indexing is likely to be removed in future; possibly as "
48                   "early as PyBIDS 0.14. This includes the `config_filename`, "
49                   "`ignore`, `force_index`, and `index_metadata` arguments. "
50                   "The recommended usage pattern is to initialize a new "
51                   "BIDSLayoutIndexer with these arguments, and pass it to "
52                   "the BIDSLayout via the `indexer` argument.")
53 
54 
55 def validate_root(root, validate):
56     # Validate root argument and make sure it contains mandatory info
57     try:
58         root = str(root)
59     except:
60         raise TypeError("root argument must be a string (or a type that "
61                         "supports casting to string, such as "
62                         "pathlib.Path) specifying the directory "
63                         "containing the BIDS dataset.")
64 
65     root = os.path.abspath(root)
66 
67     if not os.path.exists(root):
68         raise ValueError("BIDS root does not exist: %s" % root)
69 
70     target = os.path.join(root, 'dataset_description.json')
71     if not os.path.exists(target):
72         if validate:
73             raise BIDSValidationError(
74                 "'dataset_description.json' is missing from project root."
75                 " Every valid BIDS dataset must have this file."
76                 "\nExample contents of 'dataset_description.json': \n%s" %
77                 json.dumps(EXAMPLE_BIDS_DESCRIPTION)
78             )
79         else:
80             description = None
81     else:
82         with open(target, 'r', encoding='utf-8') as desc_fd:
83             description = json.load(desc_fd)
84         if validate:
85             for k in MANDATORY_BIDS_FIELDS:
86                 if k not in description:
87                     raise BIDSValidationError(
88                         "Mandatory %r field missing from "
89                         "'dataset_description.json'."
90                         "\nExample: %s" % (k, MANDATORY_BIDS_FIELDS[k])
91                     )
92 
93     return root, description
94 
95 
96 def validate_derivative_paths(paths, layout=None, **kwargs):
97 
98     deriv_dirs = []
99 
100     # Collect all paths that contain a dataset_description.json
101     def check_for_description(bids_dir):
102         dd = os.path.join(bids_dir, 'dataset_description.json')
103         return os.path.exists(dd)
104 
105     for p in paths:
106         p = os.path.abspath(str(p))
107         if os.path.exists(p):
108             if check_for_description(p):
109                 deriv_dirs.append(p)
110             else:
111                 subdirs = [d for d in os.listdir(p)
112                             if os.path.isdir(os.path.join(p, d))]
113                 for sd in subdirs:
114                     sd = os.path.join(p, sd)
115                     if check_for_description(sd):
116                         deriv_dirs.append(sd)
117 
118     if not deriv_dirs:
119         warnings.warn("Derivative indexing was requested, but no valid "
120                         "datasets were found in the specified locations "
121                         "({}). Note that all BIDS-Derivatives datasets must"
122                         " meet all the requirements for BIDS-Raw datasets "
123                         "(a common problem is to fail to include a "
124                         "'dataset_description.json' file in derivatives "
125                         "datasets).\n".format(paths) +
126                         "Example contents of 'dataset_description.json':\n%s" %
127                         json.dumps(EXAMPLE_DERIVATIVES_DESCRIPTION))
128 
129     paths = {}
130 
131     for deriv in deriv_dirs:
132         dd = os.path.join(deriv, 'dataset_description.json')
133         with open(dd, 'r', encoding='utf-8') as ddfd:
134             description = json.load(ddfd)
135         pipeline_name = description.get(
136             'PipelineDescription', {}).get('Name')
137         if pipeline_name is None:
138             raise BIDSDerivativesValidationError(
139                                 "Every valid BIDS-derivatives dataset must "
140                                 "have a PipelineDescription.Name field set "
141                                 "inside 'dataset_description.json'. "
142                                 "\nExample: %s" %
143                                 MANDATORY_DERIVATIVES_FIELDS['PipelineDescription.Name'])
144         if layout is not None and pipeline_name in layout.derivatives:
145             raise BIDSDerivativesValidationError(
146                                 "Pipeline name '%s' has already been added "
147                                 "to this BIDSLayout. Every added pipeline "
148                                 "must have a unique name!")
149         paths[pipeline_name] = deriv
150 
151     return paths
152 
153 
154 def validate_indexing_args(ignore, force_index, root):
155     if ignore is None:
156         ignore = DEFAULT_LOCATIONS_TO_IGNORE
157 
158     # Do after root validation to ensure os.path.join works
159     ignore = [os.path.abspath(os.path.join(root, patt))
160                     if isinstance(patt, str) else patt
161                     for patt in listify(ignore or [])]
162     force_index = [os.path.abspath(os.path.join(root, patt))
163                    if isinstance(patt, str) else patt
164                    for patt in listify(force_index or [])]
165 
166     # Derivatives get special handling; they shouldn't be indexed normally
167     if force_index is not None:
168         for entry in force_index:
169             condi = (isinstance(entry, str) and
170                         os.path.normpath(entry).startswith('derivatives'))
171             if condi:
172                 msg = ("Do not pass 'derivatives' in the force_index "
173                         "list. To index derivatives, either set "
174                         "derivatives=True, or use add_derivatives().")
175                 raise ValueError(msg)
176 
177     return ignore, force_index
178
```
--- 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/bids/layout/validation.py b/bids/layout/validation.py
--- a/bids/layout/validation.py
+++ b/bids/layout/validation.py
@@ -79,9 +79,21 @@
         else:
             description = None
     else:
-        with open(target, 'r', encoding='utf-8') as desc_fd:
-            description = json.load(desc_fd)
+        try:
+            with open(target, 'r', encoding='utf-8') as desc_fd:
+                description = json.load(desc_fd)
+        except json.JSONDecodeError:
+            description = None
         if validate:
+
+            if description is None:
+                raise BIDSValidationError(
+                    "'dataset_description.json' is not a valid json file."
+                    " There is likely a typo in your 'dataset_description.json'."
+                    "\nExample contents of 'dataset_description.json': \n%s" %
+                    json.dumps(EXAMPLE_BIDS_DESCRIPTION)
+                )
+            
             for k in MANDATORY_BIDS_FIELDS:
                 if k not in description:
                     raise BIDSValidationError(

{"golden_diff": "diff --git a/bids/layout/validation.py b/bids/layout/validation.py\n--- a/bids/layout/validation.py\n+++ b/bids/layout/validation.py\n@@ -79,9 +79,21 @@\n         else:\n             description = None\n     else:\n-        with open(target, 'r', encoding='utf-8') as desc_fd:\n-            description = json.load(desc_fd)\n+        try:\n+            with open(target, 'r', encoding='utf-8') as desc_fd:\n+                description = json.load(desc_fd)\n+        except json.JSONDecodeError:\n+            description = None\n         if validate:\n+\n+            if description is None:\n+                raise BIDSValidationError(\n+                    \"'dataset_description.json' is not a valid json file.\"\n+                    \" There is likely a typo in your 'dataset_description.json'.\"\n+                    \"\\nExample contents of 'dataset_description.json': \\n%s\" %\n+                    json.dumps(EXAMPLE_BIDS_DESCRIPTION)\n+                )\n+            \n             for k in MANDATORY_BIDS_FIELDS:\n                 if k not in description:\n                     raise BIDSValidationError(\n", "issue": "unclear validation error with dataset_description.json\nA couple people have posted asking why their datasets could not be read (through fmriprep or mriqc), since the error message did not indicate which file was not formatted correctly.\r\n\r\nexample error message\r\n```\r\njson.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)\r\n```\r\n\r\n- example 1: https://neurostars.org/t/fmriprep1-2-3-jsondecode-error-expecting-value/3352\r\n- example 2: https://neurostars.org/t/week-8-quiz-question-10/18410\n", "before_files": [{"content": "\"\"\"Functionality related to validation of BIDSLayouts and BIDS projects.\"\"\"\n\nimport os\nimport json\nimport re\nimport warnings\n\nfrom ..utils import listify\nfrom ..exceptions import BIDSValidationError, BIDSDerivativesValidationError\n\n\nMANDATORY_BIDS_FIELDS = {\n    \"Name\": {\"Name\": \"Example dataset\"},\n    \"BIDSVersion\": {\"BIDSVersion\": \"1.0.2\"},\n}\n\n\nMANDATORY_DERIVATIVES_FIELDS = {\n    **MANDATORY_BIDS_FIELDS,\n    \"PipelineDescription.Name\": {\n        \"PipelineDescription\": {\"Name\": \"Example pipeline\"}\n    },\n}\n\nEXAMPLE_BIDS_DESCRIPTION = {\n    k: val[k] for val in MANDATORY_BIDS_FIELDS.values() for k in val}\n\n\nEXAMPLE_DERIVATIVES_DESCRIPTION = {\n    k: val[k] for val in MANDATORY_DERIVATIVES_FIELDS.values() for k in val}\n\n\nDEFAULT_LOCATIONS_TO_IGNORE = (\"code\", \"stimuli\", \"sourcedata\", \"models\",\n                               re.compile(r'^\\.'))\n\ndef absolute_path_deprecation_warning():\n    warnings.warn(\"The absolute_paths argument will be removed from PyBIDS \"\n                  \"in 0.14. You can easily access the relative path of \"\n                  \"BIDSFile objects via the .relpath attribute (instead of \"\n                  \".path). Switching to this pattern is strongly encouraged, \"\n                  \"as the current implementation of relative path handling \"\n                  \"is known to produce query failures in certain edge cases.\")\n\n\ndef indexer_arg_deprecation_warning():\n    warnings.warn(\"The ability to pass arguments to BIDSLayout that control \"\n                  \"indexing is likely to be removed in future; possibly as \"\n                  \"early as PyBIDS 0.14. This includes the `config_filename`, \"\n                  \"`ignore`, `force_index`, and `index_metadata` arguments. \"\n                  \"The recommended usage pattern is to initialize a new \"\n                  \"BIDSLayoutIndexer with these arguments, and pass it to \"\n                  \"the BIDSLayout via the `indexer` argument.\")\n\n\ndef validate_root(root, validate):\n    # Validate root argument and make sure it contains mandatory info\n    try:\n        root = str(root)\n    except:\n        raise TypeError(\"root argument must be a string (or a type that \"\n                        \"supports casting to string, such as \"\n                        \"pathlib.Path) specifying the directory \"\n                        \"containing the BIDS dataset.\")\n\n    root = os.path.abspath(root)\n\n    if not os.path.exists(root):\n        raise ValueError(\"BIDS root does not exist: %s\" % root)\n\n    target = os.path.join(root, 'dataset_description.json')\n    if not os.path.exists(target):\n        if validate:\n            raise BIDSValidationError(\n                \"'dataset_description.json' is missing from project root.\"\n                \" Every valid BIDS dataset must have this file.\"\n                \"\\nExample contents of 'dataset_description.json': \\n%s\" %\n                json.dumps(EXAMPLE_BIDS_DESCRIPTION)\n            )\n        else:\n            description = None\n    else:\n        with open(target, 'r', encoding='utf-8') as desc_fd:\n            description = json.load(desc_fd)\n        if validate:\n            for k in MANDATORY_BIDS_FIELDS:\n                if k not in description:\n                    raise BIDSValidationError(\n                        \"Mandatory %r field missing from \"\n                        \"'dataset_description.json'.\"\n                        \"\\nExample: %s\" % (k, MANDATORY_BIDS_FIELDS[k])\n                    )\n\n    return root, description\n\n\ndef validate_derivative_paths(paths, layout=None, **kwargs):\n\n    deriv_dirs = []\n\n    # Collect all paths that contain a dataset_description.json\n    def check_for_description(bids_dir):\n        dd = os.path.join(bids_dir, 'dataset_description.json')\n        return os.path.exists(dd)\n\n    for p in paths:\n        p = os.path.abspath(str(p))\n        if os.path.exists(p):\n            if check_for_description(p):\n                deriv_dirs.append(p)\n            else:\n                subdirs = [d for d in os.listdir(p)\n                            if os.path.isdir(os.path.join(p, d))]\n                for sd in subdirs:\n                    sd = os.path.join(p, sd)\n                    if check_for_description(sd):\n                        deriv_dirs.append(sd)\n\n    if not deriv_dirs:\n        warnings.warn(\"Derivative indexing was requested, but no valid \"\n                        \"datasets were found in the specified locations \"\n                        \"({}). Note that all BIDS-Derivatives datasets must\"\n                        \" meet all the requirements for BIDS-Raw datasets \"\n                        \"(a common problem is to fail to include a \"\n                        \"'dataset_description.json' file in derivatives \"\n                        \"datasets).\\n\".format(paths) +\n                        \"Example contents of 'dataset_description.json':\\n%s\" %\n                        json.dumps(EXAMPLE_DERIVATIVES_DESCRIPTION))\n\n    paths = {}\n\n    for deriv in deriv_dirs:\n        dd = os.path.join(deriv, 'dataset_description.json')\n        with open(dd, 'r', encoding='utf-8') as ddfd:\n            description = json.load(ddfd)\n        pipeline_name = description.get(\n            'PipelineDescription', {}).get('Name')\n        if pipeline_name is None:\n            raise BIDSDerivativesValidationError(\n                                \"Every valid BIDS-derivatives dataset must \"\n                                \"have a PipelineDescription.Name field set \"\n                                \"inside 'dataset_description.json'. \"\n                                \"\\nExample: %s\" %\n                                MANDATORY_DERIVATIVES_FIELDS['PipelineDescription.Name'])\n        if layout is not None and pipeline_name in layout.derivatives:\n            raise BIDSDerivativesValidationError(\n                                \"Pipeline name '%s' has already been added \"\n                                \"to this BIDSLayout. Every added pipeline \"\n                                \"must have a unique name!\")\n        paths[pipeline_name] = deriv\n\n    return paths\n\n\ndef validate_indexing_args(ignore, force_index, root):\n    if ignore is None:\n        ignore = DEFAULT_LOCATIONS_TO_IGNORE\n\n    # Do after root validation to ensure os.path.join works\n    ignore = [os.path.abspath(os.path.join(root, patt))\n                    if isinstance(patt, str) else patt\n                    for patt in listify(ignore or [])]\n    force_index = [os.path.abspath(os.path.join(root, patt))\n                   if isinstance(patt, str) else patt\n                   for patt in listify(force_index or [])]\n\n    # Derivatives get special handling; they shouldn't be indexed normally\n    if force_index is not None:\n        for entry in force_index:\n            condi = (isinstance(entry, str) and\n                        os.path.normpath(entry).startswith('derivatives'))\n            if condi:\n                msg = (\"Do not pass 'derivatives' in the force_index \"\n                        \"list. To index derivatives, either set \"\n                        \"derivatives=True, or use add_derivatives().\")\n                raise ValueError(msg)\n\n    return ignore, force_index\n", "path": "bids/layout/validation.py"}], "after_files": [{"content": "\"\"\"Functionality related to validation of BIDSLayouts and BIDS projects.\"\"\"\n\nimport os\nimport json\nimport re\nimport warnings\n\nfrom ..utils import listify\nfrom ..exceptions import BIDSValidationError, BIDSDerivativesValidationError\n\n\nMANDATORY_BIDS_FIELDS = {\n    \"Name\": {\"Name\": \"Example dataset\"},\n    \"BIDSVersion\": {\"BIDSVersion\": \"1.0.2\"},\n}\n\n\nMANDATORY_DERIVATIVES_FIELDS = {\n    **MANDATORY_BIDS_FIELDS,\n    \"PipelineDescription.Name\": {\n        \"PipelineDescription\": {\"Name\": \"Example pipeline\"}\n    },\n}\n\nEXAMPLE_BIDS_DESCRIPTION = {\n    k: val[k] for val in MANDATORY_BIDS_FIELDS.values() for k in val}\n\n\nEXAMPLE_DERIVATIVES_DESCRIPTION = {\n    k: val[k] for val in MANDATORY_DERIVATIVES_FIELDS.values() for k in val}\n\n\nDEFAULT_LOCATIONS_TO_IGNORE = (\"code\", \"stimuli\", \"sourcedata\", \"models\",\n                               re.compile(r'^\\.'))\n\ndef absolute_path_deprecation_warning():\n    warnings.warn(\"The absolute_paths argument will be removed from PyBIDS \"\n                  \"in 0.14. You can easily access the relative path of \"\n                  \"BIDSFile objects via the .relpath attribute (instead of \"\n                  \".path). Switching to this pattern is strongly encouraged, \"\n                  \"as the current implementation of relative path handling \"\n                  \"is known to produce query failures in certain edge cases.\")\n\n\ndef indexer_arg_deprecation_warning():\n    warnings.warn(\"The ability to pass arguments to BIDSLayout that control \"\n                  \"indexing is likely to be removed in future; possibly as \"\n                  \"early as PyBIDS 0.14. This includes the `config_filename`, \"\n                  \"`ignore`, `force_index`, and `index_metadata` arguments. \"\n                  \"The recommended usage pattern is to initialize a new \"\n                  \"BIDSLayoutIndexer with these arguments, and pass it to \"\n                  \"the BIDSLayout via the `indexer` argument.\")\n\n\ndef validate_root(root, validate):\n    # Validate root argument and make sure it contains mandatory info\n    try:\n        root = str(root)\n    except:\n        raise TypeError(\"root argument must be a string (or a type that \"\n                        \"supports casting to string, such as \"\n                        \"pathlib.Path) specifying the directory \"\n                        \"containing the BIDS dataset.\")\n\n    root = os.path.abspath(root)\n\n    if not os.path.exists(root):\n        raise ValueError(\"BIDS root does not exist: %s\" % root)\n\n    target = os.path.join(root, 'dataset_description.json')\n    if not os.path.exists(target):\n        if validate:\n            raise BIDSValidationError(\n                \"'dataset_description.json' is missing from project root.\"\n                \" Every valid BIDS dataset must have this file.\"\n                \"\\nExample contents of 'dataset_description.json': \\n%s\" %\n                json.dumps(EXAMPLE_BIDS_DESCRIPTION)\n            )\n        else:\n            description = None\n    else:\n        try:\n            with open(target, 'r', encoding='utf-8') as desc_fd:\n                description = json.load(desc_fd)\n        except json.JSONDecodeError:\n            description = None\n        if validate:\n\n            if description is None:\n                raise BIDSValidationError(\n                    \"'dataset_description.json' is not a valid json file.\"\n                    \" There is likely a typo in your 'dataset_description.json'.\"\n                    \"\\nExample contents of 'dataset_description.json': \\n%s\" %\n                    json.dumps(EXAMPLE_BIDS_DESCRIPTION)\n                )\n            \n            for k in MANDATORY_BIDS_FIELDS:\n                if k not in description:\n                    raise BIDSValidationError(\n                        \"Mandatory %r field missing from \"\n                        \"'dataset_description.json'.\"\n                        \"\\nExample: %s\" % (k, MANDATORY_BIDS_FIELDS[k])\n                    )\n\n    return root, description\n\n\ndef validate_derivative_paths(paths, layout=None, **kwargs):\n\n    deriv_dirs = []\n\n    # Collect all paths that contain a dataset_description.json\n    def check_for_description(bids_dir):\n        dd = os.path.join(bids_dir, 'dataset_description.json')\n        return os.path.exists(dd)\n\n    for p in paths:\n        p = os.path.abspath(str(p))\n        if os.path.exists(p):\n            if check_for_description(p):\n                deriv_dirs.append(p)\n            else:\n                subdirs = [d for d in os.listdir(p)\n                            if os.path.isdir(os.path.join(p, d))]\n                for sd in subdirs:\n                    sd = os.path.join(p, sd)\n                    if check_for_description(sd):\n                        deriv_dirs.append(sd)\n\n    if not deriv_dirs:\n        warnings.warn(\"Derivative indexing was requested, but no valid \"\n                        \"datasets were found in the specified locations \"\n                        \"({}). Note that all BIDS-Derivatives datasets must\"\n                        \" meet all the requirements for BIDS-Raw datasets \"\n                        \"(a common problem is to fail to include a \"\n                        \"'dataset_description.json' file in derivatives \"\n                        \"datasets).\\n\".format(paths) +\n                        \"Example contents of 'dataset_description.json':\\n%s\" %\n                        json.dumps(EXAMPLE_DERIVATIVES_DESCRIPTION))\n\n    paths = {}\n\n    for deriv in deriv_dirs:\n        dd = os.path.join(deriv, 'dataset_description.json')\n        with open(dd, 'r', encoding='utf-8') as ddfd:\n            description = json.load(ddfd)\n        pipeline_name = description.get(\n            'PipelineDescription', {}).get('Name')\n        if pipeline_name is None:\n            raise BIDSDerivativesValidationError(\n                                \"Every valid BIDS-derivatives dataset must \"\n                                \"have a PipelineDescription.Name field set \"\n                                \"inside 'dataset_description.json'. \"\n                                \"\\nExample: %s\" %\n                                MANDATORY_DERIVATIVES_FIELDS['PipelineDescription.Name'])\n        if layout is not None and pipeline_name in layout.derivatives:\n            raise BIDSDerivativesValidationError(\n                                \"Pipeline name '%s' has already been added \"\n                                \"to this BIDSLayout. Every added pipeline \"\n                                \"must have a unique name!\")\n        paths[pipeline_name] = deriv\n\n    return paths\n\n\ndef validate_indexing_args(ignore, force_index, root):\n    if ignore is None:\n        ignore = DEFAULT_LOCATIONS_TO_IGNORE\n\n    # Do after root validation to ensure os.path.join works\n    ignore = [os.path.abspath(os.path.join(root, patt))\n                    if isinstance(patt, str) else patt\n                    for patt in listify(ignore or [])]\n    force_index = [os.path.abspath(os.path.join(root, patt))\n                   if isinstance(patt, str) else patt\n                   for patt in listify(force_index or [])]\n\n    # Derivatives get special handling; they shouldn't be indexed normally\n    if force_index is not None:\n        for entry in force_index:\n            condi = (isinstance(entry, str) and\n                        os.path.normpath(entry).startswith('derivatives'))\n            if condi:\n                msg = (\"Do not pass 'derivatives' in the force_index \"\n                        \"list. To index derivatives, either set \"\n                        \"derivatives=True, or use add_derivatives().\")\n                raise ValueError(msg)\n\n    return ignore, force_index\n", "path": "bids/layout/validation.py"}]}