Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

WordPress Importer: process stop and stuck on a certain post number

  • #9215
    Avatar photo[anonymous]

    Hi,

    I plan to migrate some sites (more than one) from WordPress to Publii. This happens when I try to import, like:
    website A –> always stop and stuck on post #38
    website B –> always stop and stuck on post #16
    website C –> always stop and stuck on post #210
    etc…see the attachment

    At first, I think it is because I do some find and replace (for image styling) mistakes that make the XML file broken. But, when I try again without any “find and replace” the problem still happens exactly on that post number. I also already try this:
    – deactivate all plugins and set the permalink to a plain number (not postname permalink) before making an export file. still not solved.

    Please help. Is there any other clue/things that I should check to solve this?

    Best Regards,

    #9219
    Avatar photo[anonymous]

    Import-error log:

    C:\Users\DELL\AppData\Local\Programs\Publii\resources\app.asar\back-end\post.js:495
    sqlQuery.run({
    ^
    SqliteError: UNIQUE constraint failed: posts_tags.tag_id, posts_tags.post_id
    at Post.saveTag (C:\Users\DELL\AppData\Local\Programs\Publii\resources\app.asar\back-end\post.js:495:18)
    at Post.saveTags (C:\Users\DELL\AppData\Local\Programs\Publii\resources\app.asar\back-end\post.js:466:22)
    at Post.save (C:\Users\DELL\AppData\Local\Programs\Publii\resources\app.asar\back-end\post.js:249:14)
    at WxrParser.importPostsData (C:\Users\DELL\AppData\Local\Programs\Publii\resources\app.asar\back-end\modules\import\wxr-parser.js:434:41)
    at Import.importFile (C:\Users\DELL\AppData\Local\Programs\Publii\resources\app.asar\back-end\modules\import\import.js:93:21)
    at process.<anonymous> (C:\Users\DELL\AppData\Local\Programs\Publii\resources\app.asar\back-end\workers\import\import.js:14:18)
    at process.emit (node:events:526:28)
    at emit (node:internal/child_process:938:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
    code: ‘SQLITE_CONSTRAINT_PRIMARYKEY’
    }

    #9227
    Avatar photo[anonymous]

    Have tried these before making WP export file, but still not solved with exact same problem:

    1. Deactivate and delete all WP plugins.
    2. Use the default WordPress theme.
    3. Delete all tags.
    4. Set permalink to plain, not postname.

    This problem is weird and looks inconsistent. I have tried to export 14 websites, and 4 of them are successful, but 10 have exact same problem: the import process stops and stuck on a certain post number.

    #9230
    Avatar photo[anonymous]

    Hi,

    According to the error it seems that for some reasons you have some duplicated tags for the same posts. In fact such situation is not correct, but for me it is hard to say how it is possible.

    Could you attach some example of the problematic WXR file as a private reply?

    #9238
    Avatar photo[anonymous]
    This reply has been marked as private.
    #9252
    Avatar photo[anonymous]

    Thank you for the WXR file – I will try to check this problem over the weekend 🙂

    #9260
    Avatar photo[anonymous]

    Hi,

    Thx a lot and respect your response to checking this problem. Fortunately, I have found the solution. Problem solved.

    I don’t know the real problem, because I don’t know the real logic/code behind the wp importer plugin. But, here are what I do, hope this can help other with the same problem or the developer of the plugin:

    1. Look for the post title where the import process stops. If the process stops at post #38, find post #39 (this is the problematic post that makes the import process stop), then see the post category. In my case, I have found two possible causes:
    2. Somehow I have two CHILD categories with the same exact name on that post (eg. cooking, cooking). Solution: I uncheck one category from the post and then delete that one category sitewide.
    3. But, the problem does not stop there, I also find that problematic posts have “similar” PARENT and CHILD category names. This post is also problematic. This is exactly what I have, a post with title: “bla bla bla”, parent category: “Cooking, Food & Recipes”, and child category: “Cooking”. Solution: I uncheck the post parent category, and check the child category only.

    That’s it.

    Best regards,

    #9262
    Avatar photo[anonymous]

    Hi kinjgr,

    Thank you for your update. It seems that it will require bigger update of the WP Importer – I will try to do it next week to solve such issues in Publii v.0.42 🙂

    #9326
    Avatar photo[anonymous]

    Hi kinjgr,

    The issue was in fact even bigger, because due invalid implementation WXR was failed when you have comma in the category/tag name and it covers with existing tag. In fact we had protection to avoid double tag assignment.

    Also I have fixed issue when by naming tag “test1,test2”, you got in fact two tags 🙂

    Everything will be fixed in Publii v.0.42