<p>I found issue using {slug} in Global when sharing same asset field. Ended up leaving {slug} in entries field and using {id} for Global asset field (created new field), not sure if there is a better way to use Asset in global</p>

CC BY-SA 3.0
2018-01-10T17:22:43.957Z
2018-01-10T17:22:43.957Z
Davor
<p>If you're setting an dynamic upload folder location for an Assets field inside of a Matrix field, you need to preface things like <code>{slug}</code> with <code>{owner.slug}</code>.</p>

<p>See the note about dynamic subfolders on an Assets field inside of Matrix here: <a href="https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths" rel="noreferrer">https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths</a></p>

CC BY-SA 3.0
2017-10-10T12:13:30.600Z
Glad this question was on here. Just had the same issue, where dynamic subfolders were working for standard fields, but not Matrix.
darylknight
CC BY-SA 3.0
2017-04-18T21:45:35.893Z
2017-04-18T21:45:35.893Z
Brad Bell
<p>After updating to 2.6.2973, saving any entry fails, resulting in an Internal Server Error: "Could not resolve the subpath '{slug}'".</p>

<p>I've read the similar errors on here which trace back to Matrix Asset objects and dynamically-named folders, though I'm not using any dynamically-named folders, and I can't tell where it's pulling {slug} from, and/or what's causes the issue. I've gone through and double-checked and resaved both asset directory and field configurations.</p>

<p>The log again points in the direction of the Matrix Asset, and refers to the folder id "1" -- a Local Source which has both the System Path and URL completely hardcoded. The top of the trace looks like so:</p>

<pre><code>#0 /[directory-path]/craft/app/fieldtypes/AssetsFieldType.php(707): Craft\AssetsFieldType-&gt;_resolveSourcePathToFolderId('1', '{slug}', true)
#1 /[directory-path]/craft/app/fieldtypes/AssetsFieldType.php(327): Craft\AssetsFieldType-&gt;_determineUploadFolderId(Object(Craft\Model))
#2 /[directory-path]/craft/app/services/ElementsService.php(1618): Craft\AssetsFieldType-&gt;onAfterElementSave()
#3 /[directory-path]/craft/app/services/MatrixService.php(778): Craft\ElementsService-&gt;saveElement(Object(Craft\MatrixBlockModel), false)
#4 /[directory-path]/craft/app/services/MatrixService.php(882): Craft\MatrixService-&gt;saveBlock(Object(Craft\MatrixBlockModel), false)
#5 /[directory-path]/craft/app/fieldtypes/MatrixFieldType.php(533): Craft\MatrixService-&gt;saveField(Object(Craft\MatrixFieldType))
</code></pre>

<p>This error stalls all the client's content entry, so I hoping for any additional insights or tips. Thanks so much.</p>

CC BY-SA 3.0
2017-04-18T21:00:22.903Z
The stack trace indicates you've got an Assets field inside of a Matrix field with an upload folder location set to `{slug}`. Are you sure you're looking at the correct Matrix field/Asset field combination?
Brad Bell
CC BY-SA 3.0
2017-04-18T21:43:25.193Z
That was it, Brad -- I hadn't realized I set a {slug} subfolder within the Matrix/Asset field, which needed to be {owner.slug}. Thank you!
Marcus
CC BY-SA 3.0
2017-04-18T21:44:41.143Z
Glad to help!  Will go ahead and add it as an official answer.
Brad Bell
<assets><matrix><error-message><updating>
After updating, getting "Could not resolve the subpath" error
# After updating, getting "Could not resolve the subpath" error

(Asked by: username_0 on 2017-04-18)

After updating to 2.6.2973, saving any entry fails, resulting in an Internal Server Error: "Could not resolve the subpath '{slug}'".
I've read the similar errors on here which trace back to Matrix Asset objects and dynamically-named folders, though I'm not using any dynamically-named folders, and I can't tell where it's pulling {slug} from, and/or what's causes the issue. I've gone through and double-checked and resaved both asset directory and field configurations.
The log again points in the direction of the Matrix Asset, and refers to the folder id "1" -- a Local Source which has both the System Path and URL completely hardcoded. The top of the trace looks like so:
#0 /[directory-path]/craft/app/fieldtypes/AssetsFieldType.php(707): Craft\AssetsFieldType->_resolveSourcePathToFolderId('1', '{slug}', true)
#1 /[directory-path]/craft/app/fieldtypes/AssetsFieldType.php(327): Craft\AssetsFieldType->_determineUploadFolderId(Object(Craft\Model))
#2 /[directory-path]/craft/app/services/ElementsService.php(1618): Craft\AssetsFieldType->onAfterElementSave()
#3 /[directory-path]/craft/app/services/MatrixService.php(778): Craft\ElementsService->saveElement(Object(Craft\MatrixBlockModel), false)
#4 /[directory-path]/craft/app/services/MatrixService.php(882): Craft\MatrixService->saveBlock(Object(Craft\MatrixBlockModel), false)
#5 /[directory-path]/craft/app/fieldtypes/MatrixFieldType.php(533): Craft\MatrixService->saveField(Object(Craft\MatrixFieldType))

This error stalls all the client's content entry, so I hoping for any additional insights or tips. Thanks so much.

**Tags:** assets, matrix, error-message, updating
> **Comments:**
> **username_1**: The stack trace indicates you've got an Assets field inside of a Matrix field with an upload folder location set to `{slug}`. Are you sure you're looking at the correct Matrix field/Asset field combination?  
> **username_0**: That was it, Brad -- I hadn't realized I set a {slug} subfolder within the Matrix/Asset field, which needed to be {owner.slug}. Thank you!  
> **username_1**: Glad to help!  Will go ahead and add it as an official answer.  

---

## 2 answers

### Answer by username_1 on 2017-04-18. Score: 6 | Accepted answer

If you're setting an dynamic upload folder location for an Assets field inside of a Matrix field, you need to preface things like `{slug}` with `{owner.slug}`.

See the note about dynamic subfolders on an Assets field inside of Matrix here: <https://craftcms.com/docs/assets-fields#dynamic-subfolder-paths>

> **Comments:**
> **username_3**: Glad this question was on here. Just had the same issue, where dynamic subfolders were working for standard fields, but not Matrix.  

---

### Answer by username_2 on 2018-01-10. Score: 1

I found issue using {slug} in Global when sharing same asset field. Ended up leaving {slug} in entries field and using {id} for Global asset field (created new field), not sure if there is a better way to use Asset in global


---

