I'm converting markdown to richText and I'm trying to change the images into embedded-entry-block

I’m pasting here just the code where the embedded-entry-block is created

for (let i = 0; i < content.content.length; i++) {
    if (content.content[i].value == imageReference) {
        if (images.length > 0) {
            const image = images.shift();
            const richImageId = await buildTheRichImage(image, sourceEnv);

            content.content[i] = {
                nodeType: 'embedded-entry-block',
                data: {
                    target: {
                        sys: {
                            id: richImageId,
                            type: 'Link',
                            linkType: 'Entry'
                        }
                    }
                },
                content: [],
            };

            console.log(content.content[i]);
        } else {
            throw new Error('No images left');
        }
    }
}

That should be instead of the image:

{
  nodeType: 'embedded-entry-block',
  data: { target: { sys:{ id: richImageId, type: 'Link', linkType: 'Entry' } } },
  content: []
}

But I’m getting that error when I’m trying to create the richText

"errors": [{
    "name": "in",
    "details": "Value must be one of expected values",
    "path": [
        "fields",
        "content",
        "en-US",
        "content",
        4,
        "content",
        0,
        "nodeType"
    ],
    "value": "embedded-entry-block",
    "expected": [
        "asset-hyperlink",
        "embedded-entry-inline",
        "entry-hyperlink",
        "hyperlink"
    ]
}]

And when I’m using the graph QL on a existing richText created on platform I get the RichImage returned like this, how can I create the same embedded-entry-block if that type is not supported?

 {
              "nodeType": "embedded-entry-block",
              "data": {
                "target": {
                  "sys": {
                    "id": "6nlf6W9djuQI58lmTHpurx",
                    "type": "Link",
                    "linkType": "Entry"
                  }
                }
              },
              "content": []
            }

Thanks!

Found the issue, I was seeing a lot of these errors, in my case the embedded-entry-block it was inside a paragraph and that was the issue, I had to move it from the paragraph and to create it outside.