OrchardCMS/OrchardCore · error · InvalidOperationException

Could not find content item

Error message

Could not find content item 

What it means

metaWeblog.getRecentPosts requires the contentItemId to reference an existing list (e.g. a Blog). If IContentManager.GetAsync returns null the handler throws 'Could not find content item ' + contentItemId (note the unlocalized string with no closing punctuation).

Solutions

  1. Verify the blogId/content item ID in the client config matches an existing Blog content item's ID (copy it from the admin URL)
  2. Check you are connecting to the correct tenant/site URL
  3. Recreate or republish the blog and update the client
Defensive patterns

Strategy: try-catch

Validate before calling

var exists = await contentManager.GetAsync(blogId); if (exists == null) throw new ArgumentException($"Blog '{blogId}' does not exist on this site");

Type guard

bool IsValidContentItem(ContentItem item) => item != null && !string.IsNullOrEmpty(item.ContentItemId);

Try / catch

try { posts = await handler.MetaWeblogGetRecentPosts(blogId, ...); } catch (InvalidOperationException ex) when (ex.Message.StartsWith("Could not find content item")) { RefreshBlogConfiguration(); }

Prevention

When it happens

Trigger: Calling getRecentPosts with a blogId that does not match any content item ID, or with a deleted/unpublished-removed item.

Common situations: Mistyped or stale blog ID in blog client configuration; connecting to the wrong tenant/site; content deleted after the client was configured.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13). Data as JSON: /api/errors/9cc59404c2f25861. Report an issue: GitHub.

Appendix: source

Thrown at src/OrchardCore.Modules/OrchardCore.Lists/RemotePublishing/MetaWeblogHandler.cs:265

        return array;
    }

    private async Task<XRpcArray> MetaWeblogGetRecentPosts(
        XmlRpcContext context,
        string contentItemId,
        string userName,
        string password,
        int numberOfPosts,
        IEnumerable<IXmlRpcDriver> drivers)
    {
        var user = await ValidateUserAsync(userName, password);

        // User needs to at least have permission to edit its own blog posts to access the service.
        await CheckAccessAsync(CommonPermissions.EditContent, user, null);

        var list = (await _contentManager.GetAsync(contentItemId))
            ?? throw new InvalidOperationException("Could not find content item " + contentItemId);

        var array = new XRpcArray();

        var contentItems = await _session.Query<ContentItem>()
            .With<ContainedPartIndex>(x => x.ListContentItemId == contentItemId)
            .With<ContentItemIndex>(x => x.Latest)
            .OrderByDescending(x => x.CreatedUtc)
            .Take(numberOfPosts)
            .ListAsync();

        foreach (var contentItem in contentItems)
        {
            var postStruct = await CreateBlogStructAsync(context, contentItem);

            foreach (var driver in drivers)
            {
                driver.Process(postStruct);
            }

View on GitHub (pinned to 4306c0717f)