diff --git a/bids/layout/config/bids.json b/bids/layout/config/bids.json
index 180fa1fe..8ad8faf0 100644
--- a/bids/layout/config/bids.json
+++ b/bids/layout/config/bids.json
@@ -21,7 +21,7 @@
             "pattern": "[_/\\\\]+acq-([a-zA-Z0-9]+)"
         },
         {
-            "name": "contrast",
+            "name": "ceagent",
             "pattern": "[_/\\\\]+ce-([a-zA-Z0-9]+)"
         },
         {
@@ -53,6 +53,10 @@
             "name": "recording",
             "pattern": "[_/\\\\]+recording-([a-zA-Z0-9]+)"
         },
+        {
+            "name": "space",
+            "pattern": "[_/\\\\]+space-([a-zA-Z0-9]+)"
+        },
         {
             "name": "suffix",
             "pattern": "[._]*([a-zA-Z0-9]*?)\\.[^/\\\\]+$"
@@ -76,16 +80,25 @@
     ],
 
     "default_path_patterns": [
-        "sub-{subject}[/ses-{session}]/anat/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{contrast}][_rec-{reconstruction}]_{suffix<T1w|T2w|T1rho|T1map|T2map|T2star|FLAIR|FLASH|PDmap|PD|PDT2|inplaneT[12]|angio>}.nii.gz",
-        "sub-{subject}[/ses-{session}]/anat/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{contrast}][_rec-{reconstruction}][_mod-{modality}]_{suffix<defacemask>}.nii.gz",
-        "sub-{subject}[/ses-{session}]/func/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_ce-{contrast}][_dir-{direction}][_rec-{reconstruction}][_run-{run}][_echo-{echo}]_{suffix<bold|cbv|phase|sbref>}.{extension<nii|nii.gz>|nii.gz}",
-        "sub-{subject}[/ses-{session}]/dwi/sub-{subject}[_ses-{session}][_acq-{acquisition}]_{suffix<dwi>}.{extension<bval|bvec|json|nii\\.gz|nii>|nii\\.gz}",
-        "sub-{subject}[/ses-{session}]/fmap/sub-{subject}[_ses-{session}][_acq-{acquisition}][_dir-{direction}][_run-{run}]_{fmap<phasediff|magnitude[1-2]|phase[1-2]|fieldmap|epi>}.nii.gz",
-        "sub-{subject}[/ses-{session}]/[{datatype<func|meg>|func}/]sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_rec-{reconstruction}][_run-{run}][_echo-{echo}][_recording-{recording}]_{suffix<events>}.{extension<tsv>|tsv}",
-        "sub-{subject}[/ses-{session}]/func/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_rec-{reconstruction}][_run-{run}][_echo-{echo}][_recording-{recording}]_{suffix<physio|stim>}.{extension<tsv\\.gz|json}",
-        "sub-{subject}[/ses-{session}]/meg/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_run-{run}][_proc-{proc}]_meg.{extension|json}",
-        "sub-{subject}[/ses-{session}]/meg/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_run-{run}][_proc-{proc}]_{suffix<channels>}.{extension<tsv>|tsv}",
-        "sub-{subject}[/ses-{session}]/meg/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}]_{suffix<coordsystem>}.json",
-        "sub-{subject}[/ses-{session}]/meg/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}]_{suffix<photo>}.jpg"
+        "sub-{subject}[/ses-{session}]/anat/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}]_{suffix<T1w|T2w|T1rho|T1map|T2map|T2star|FLAIR|FLASH|PDmap|PD|PDT2|inplaneT[12]|angio>}.{extension<nii|nii.gz|json>|nii.gz}",
+        "sub-{subject}[/ses-{session}]/anat/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_mod-{modality}]_{suffix<defacemask>}.{extension<nii|nii.gz|json>|nii.gz}",
+        "sub-{subject}[/ses-{session}]/func/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_ce-{ceagent}][_dir-{direction}][_rec-{reconstruction}][_run-{run}][_echo-{echo}]_{suffix<bold|cbv|phase|sbref>}.{extension<nii|nii.gz|json>|nii.gz}",
+        "sub-{subject}[/ses-{session}]/dwi/sub-{subject}[_ses-{session}][_acq-{acquisition}]_{suffix<dwi>}.{extension<bval|bvec|json|nii.gz|nii>|nii.gz}",
+        "sub-{subject}[/ses-{session}]/fmap/sub-{subject}[_ses-{session}][_acq-{acquisition}][_dir-{direction}][_run-{run}]_{fmap<phasediff|magnitude[1-2]|phase[1-2]|fieldmap>}.{extension<nii|nii.gz|json>|nii.gz}",
+        "sub-{subject}[/ses-{session}]/fmap/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}]_dir-{direction}[_run-{run}]_{fmap<epi>}.{extension<nii|nii.gz|json>|nii.gz}",
+        "sub-{subject}[/ses-{session}]/[{datatype<func|meg|beh>|func}/]sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_rec-{reconstruction}][_run-{run}][_echo-{echo}][_recording-{recording}]_{suffix<events>}.{extension<tsv|json>|tsv}",
+        "sub-{subject}[/ses-{session}]/[{datatype<func|beh>|func}/]/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_rec-{reconstruction}][_run-{run}][_echo-{echo}][_recording-{recording}]_{suffix<physio|stim>}.{extension<tsv.gz|json>|tsv.gz}",
+        "sub-{subject}[/ses-{session}]/meg/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_run-{run}][_proc-{proc}]_meg.{extension}",
+        "sub-{subject}[/ses-{session}]/meg/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}][_run-{run}][_proc-{proc}]_{suffix<channels>}.{extension<tsv|json>|tsv}",
+        "sub-{subject}[/ses-{session}]/meg/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}]_{suffix<coordsystem>}.{extension<json>|json}",
+        "sub-{subject}[/ses-{session}]/meg/sub-{subject}[_ses-{session}]_task-{task}[_acq-{acquisition}]_{suffix<photo>}.{extension<jpg>|jpg}",
+        "[acq-{acquisition}_][ce-{ceagent}_][rec-{reconstruction}_]{suffix<T1w|T2w|T1rho|T1map|T2map|T2star|FLAIR|FLASH|PDmap|PD|PDT2|inplaneT[12]|angio>}.{extension<json>|json}",
+        "[acq-{acquisition}_][ce-{ceagent}_][rec-{reconstruction}_][mod-{modality}_]{suffix<defacemask>}.{extension<json>|json}",
+        "task-{task}[_acq-{acquisition}][_ce-{ceagent}][_dir-{direction}][_rec-{reconstruction}][_run-{run}][_echo-{echo}]_{suffix<bold|cbv|phase|sbref>}.{extension<json>|json}",
+        "[acq-{acquisition}_]{suffix<dwi>}.{extension<json>|json}",
+        "[acq-{acquisition}_][dir-{direction}_][run-{run}_]{fmap<phasediff|magnitude[1-2]|phase[1-2]|fieldmap>}.{extension<json>|json}",
+        "[acq-{acquisition}_][ce-{ceagent}_]dir-{direction}[_run-{run}]_{fmap<epi>}.{extension<json>|json}",
+        "task-{task}[_acq-{acquisition}][_rec-{reconstruction}][_run-{run}][_echo-{echo}][_recording-{recording}]_{suffix<events>}.{extension<json>|json}",
+        "task-{task}[_acq-{acquisition}][_rec-{reconstruction}][_run-{run}][_echo-{echo}][_recording-{recording}]_{suffix<physio|stim>}.{extension<json>}"
     ]
 }
diff --git a/bids/layout/config/derivatives.json b/bids/layout/config/derivatives.json
index 31c1b269..a86b193d 100644
--- a/bids/layout/config/derivatives.json
+++ b/bids/layout/config/derivatives.json
@@ -1,10 +1,6 @@
 {
     "name": "derivatives",
     "entities": [
-        {
-            "name": "space",
-            "pattern": "space-([a-zA-Z0-9]+)"
-        },
         {
             "name": "atlas",
             "pattern": "atlas-([a-zA-Z0-9]+)"

Renaming ce to contrast precludes the use of contrast in statistical derivatives
#464 breaks FitLins. I recognize that these derivatives aren't standardized, but neither is "contrast" a standardized name for the "ce" entity. As it is, trying to parse a FitLins derivatives structure yields:

```
*** sqlalchemy.orm.exc.FlushError: New instance <Entity at 0x2b8e1e860c18> with identity key (<class 'bids.layout.models.Entity'>, ('contrast',), None) conflicts with persistent instance <Entity at 0x2b8e1d8da208>
```

@tyarkoni @oesteban any objections to reverting this?
diff --git a/bids/layout/tests/test_layout.py b/bids/layout/tests/test_layout.py
index 1faa7132..fe80a595 100644
--- a/bids/layout/tests/test_layout.py
+++ b/bids/layout/tests/test_layout.py
@@ -366,8 +366,7 @@ def test_derivative_getters():
     synth_path = join(get_test_data_path(), 'synthetic')
     bare_layout = BIDSLayout(synth_path, derivatives=False)
     full_layout = BIDSLayout(synth_path, derivatives=True)
-    with pytest.raises(AttributeError):
-        bare_layout.get_spaces()
+    assert bare_layout.get_spaces() == []
     assert set(full_layout.get_spaces()) == {'MNI152NLin2009cAsym', 'T1w'}
 
 
@@ -570,4 +569,4 @@ def test_get_with_wrong_dtypes(layout_7t_trt):
     assert (l.get(run=1) == l.get(run='1') == l.get(run=np.int64(1)) ==
             l.get(run=[1, '15']))
     assert not l.get(run='not_numeric')
-    assert l.get(session=1) == l.get(session='1')
\ No newline at end of file
+    assert l.get(session=1) == l.get(session='1')

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest
apt-get update apt-get install -y gcc
3.9
requirements/base.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==25.3.0
bids-validator==1.14.7.post0
bidsschematools==1.0.4
click==8.1.8
coverage==7.8.0
docopt==0.6.2
exceptiongroup==1.2.2
execnet==2.1.1
greenlet==3.1.1
importlib_resources==6.5.2
iniconfig==2.1.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
nibabel==5.3.2
num2words==0.5.14
numpy==2.0.2
packaging==24.2
pandas==2.2.3
patsy==1.0.1
pluggy==1.5.0
-e git+https://github.com/bids-standard/pybids.git@6751eec043d0d0426159ebede8d7b6020c8de6ac#egg=pybids
pytest==8.3.5
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
referencing==0.36.2
rpds-py==0.24.0
scipy==1.13.1
six==1.17.0
SQLAlchemy==2.0.40
tomli==2.2.1
typing_extensions==4.13.0
tzdata==2025.2
zipp==3.21.0

name: pybids
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==25.3.0
      - bids-validator==1.14.7.post0
      - bidsschematools==1.0.4
      - click==8.1.8
      - coverage==7.8.0
      - docopt==0.6.2
      - exceptiongroup==1.2.2
      - execnet==2.1.1
      - greenlet==3.1.1
      - importlib-resources==6.5.2
      - iniconfig==2.1.0
      - jsonschema==4.23.0
      - jsonschema-specifications==2024.10.1
      - nibabel==5.3.2
      - num2words==0.5.14
      - numpy==2.0.2
      - packaging==24.2
      - pandas==2.2.3
      - patsy==1.0.1
      - pluggy==1.5.0
      - pybids==0.9.3+48.g6751eec0
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - pytest-mock==3.14.0
      - pytest-xdist==3.6.1
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - pyyaml==6.0.2
      - referencing==0.36.2
      - rpds-py==0.24.0
      - scipy==1.13.1
      - six==1.17.0
      - sqlalchemy==2.0.40
      - tomli==2.2.1
      - typing-extensions==4.13.0
      - tzdata==2025.2
      - zipp==3.21.0
prefix: /opt/conda/envs/pybids

bids/layout/tests/test_layout.py::test_derivative_getters
bids/layout/tests/test_layout.py::test_to_df
bids/layout/tests/test_layout.py::test_layout_init bids/layout/tests/test_layout.py::test_layout_repr bids/layout/tests/test_layout.py::test_load_description bids/layout/tests/test_layout.py::test_get_file bids/layout/tests/test_layout.py::test_get_metadata bids/layout/tests/test_layout.py::test_get_metadata2 bids/layout/tests/test_layout.py::test_get_metadata3 bids/layout/tests/test_layout.py::test_get_metadata4 bids/layout/tests/test_layout.py::test_get_metadata_meg bids/layout/tests/test_layout.py::test_get_metadata5 bids/layout/tests/test_layout.py::test_get_metadata_via_bidsfile bids/layout/tests/test_layout.py::test_get_with_bad_target bids/layout/tests/test_layout.py::test_get_bvals_bvecs bids/layout/tests/test_layout.py::test_get_subjects bids/layout/tests/test_layout.py::test_get_fieldmap bids/layout/tests/test_layout.py::test_get_fieldmap2 bids/layout/tests/test_layout.py::test_bids_json bids/layout/tests/test_layout.py::test_get_return_type_dir bids/layout/tests/test_layout.py::test_get_val_none bids/layout/tests/test_layout.py::test_get_return_sorted bids/layout/tests/test_layout.py::test_force_index bids/layout/tests/test_layout.py::test_nested_include_exclude bids/layout/tests/test_layout.py::test_nested_include_exclude_with_regex bids/layout/tests/test_layout.py::test_layout_with_derivs bids/layout/tests/test_layout.py::test_layout_with_multi_derivs bids/layout/tests/test_layout.py::test_query_derivatives bids/layout/tests/test_layout.py::test_restricted_words_in_path bids/layout/tests/test_layout.py::test_get_tr bids/layout/tests/test_layout.py::test_parse_file_entities bids/layout/tests/test_layout.py::test_parse_file_entities_from_layout bids/layout/tests/test_layout.py::test_deriv_indexing bids/layout/tests/test_layout.py::test_add_config_paths bids/layout/tests/test_layout.py::test_layout_in_scope bids/layout/tests/test_layout.py::test_get_layouts_in_scope bids/layout/tests/test_layout.py::test_get_dataset_description bids/layout/tests/test_layout.py::test_indexed_file_associations bids/layout/tests/test_layout.py::test_layout_save bids/layout/tests/test_layout.py::test_indexing_tag_conflict bids/layout/tests/test_layout.py::test_get_with_wrong_dtypes
bids/layout/config/bids.json bids/layout/config/derivatives.json
bids/layout/config/bids.json bids/layout/config/derivatives.json