We are creating a public link of an asset through an action script whenever an asset is modified. The format of the public link is "Content hub domain/CDN name" + "Rendition name" + "Filename" which means Public URL is generated based on the filename.

Note: If there is already a filename with a public URL then the second instance of same filename will not be able to generate a public URL, which is fine but in some cases, we had to delete the old image and replace it with the updated correct image, in that case also Content hub is giving error while creating a public link.

   The specified target is invalid. Exception:
   Stylelabs.Scripting.Exceptions.RuntimeException: The script execution
   failed in runtime - The specified target is invalid. --->
   Stylelabs.M.Sdk.Exceptions.ValidationException: The specified target
   is invalid. Failures: Property: 'RelativeUrl'.: ‘{RelativeUrl}’
   already exists Stack trace: at
   entity) in
   /src/Stylelabs.M.Sdk.ScriptClient/Clients/EntitiesClient.cs:line 176
   at Submission#0.<CreateForRendition>d__15.MoveNext() in :line 195 ---
   End of stack trace from previous location where exception was thrown
   --- at Submission#0.<<Initialize>>d__0.MoveNext() in :line 66 --- End of stack trace from previous location where exception was thrown ---
   in /src/Stylelabs.Scripting/Engines/CSScript/Persistence.cs:line 222
   --- End of stack trace from previous location where exception was thrown --- at Stylelabs.Scripting.Script`1.Run(Object
   globalScopeObject) in /src/Stylelabs.Scripting/Script.cs:line 255 ---
   End of inner exception stack trace --- at
   Stylelabs.Scripting.Script`1.Run(Object globalScopeObject) in
   /src/Stylelabs.Scripting/Script.cs:line 259 at
   script, Func`4 scopeHandler, Func`4 resultHandler) in
   /src/Stylelabs.M.Base/Scripting/Base/ScriptSubCacheBase.cs:line 469

However, when we try to browse the existing URL, we get a 404 error. Is there any cache thing in content hub which prevents content hub to create a public link for that asset?

Update : Added error in text format, so that it will be useful for SEO.

  • Add this error in text format as well so that it will be useful for SEO. Jan 18, 2023 at 8:34
  • Sure Gaurav, i will do that. Thanks!
    – Gautam
    Jan 18, 2023 at 9:38

1 Answer 1


We created a sitecore ticket for that and after few conversations we were able to resolve that.

The issue is caused due to the following:

When an asset is deleted via the asset details page, it is actually "soft deleted". This means that the asset can still be recovered. In this case, the asset's public links are not deleted from the system, they are just disabled.

The public link is only deleted after the asset is "hard deleted". You can go to Manage > Trash to see all the assets that are currently "soft deleted". Items in trash will be permanently deleted after 30 days.

You need to "hard delete" the incorrect asset and then re-upload the file. The script works after "hard deleting" the file. We have tested this and was able to run the script with success

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.