Skip to content

Don't throw when a dependency lookup tries a non-container key as a folder - #1202

Merged
KevinJump merged 1 commit into
v17/mainfrom
fix/container-lookup-non-container-key
Nov 5, 2026
Merged

KevinJump merged 1 commit into
v17/mainfrom
fix/container-lookup-non-container-key

Conversation

@KevinJump

Copy link
Copy Markdown
Owner

SyncHandlerRoot.GetDependenciesAsync falls back to GetContainerAsync(key) when the key isn't an item of the handler's type. In Umbraco 17, EntityContainerRepository.Get(Guid) matches on UniqueId alone, so a key that belongs to any other node gets passed to CreateEntity and throws ArgumentException: Not a container object type.

uSync.Complete hits this on the first content push (with dependencies) to an empty site: its cache service catches it and logs a warning for every item.

Change

  • New private GetContainerSafeAsync in SyncHandlerRoot: catches the ArgumentException, logs at debug and returns no container.
  • GetDependenciesAsync uses it. That is the only base-class caller, so it covers the content type, media type and data type handlers.

Umbraco 18 adds the object-type filter to Get(Guid), so on v18 the lookup already returns null; forward-porting this is harmless.

Built locally; no tests run, and not reproduced against a live push.

🤖 Generated with Claude Code

…older

GetDependenciesAsync falls back to GetContainerAsync when the key isn't an
item of the handler's type. In Umbraco 17, EntityContainerRepository.Get(Guid)
matches on key alone, so a key belonging to any other node throws
"Not a container object type" rather than returning null. uSync.Complete's
cache service then logs a warning per item on the first push to an empty site.

Catch the ArgumentException in a GetContainerSafeAsync wrapper, log at debug
and treat it as no container. Umbraco 18 filters on object type, so there it
is already a null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/17.6.2 uSync 17.6.2 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant