VersionMismatch: 409 while publishing entry

I’m using contentful-managament js lib (v10.19.3) to automate content creation.
I have three linked entities – Singer → Albums → Tracks

I create a contentful client:

const space = await  contentful.createClient({ accessToken: '...'}).getSpace(space);
const client = await space.getEnvironment('..');

Then create a track an publish it:

const track = await client.createEntry(contentType.track, { 
  fields: {
await track.publish();

Create an album with the track link and publish it:

const album = await client.createEntry(contentType.album, { 
  fields: {
    tracks: [{
      sys: {
        type: 'Link',
        linkType: 'Entry',
await album.publish();

And then I add an album link to the existing Singer entry:

const singer = await client.getEntry(singerId);
const existingAlbums = singer.fields.albums || [];

const albumLink = {
  sys: {
    type: 'Link',
    linkType: 'Entry'
const mergedAlbums = [...existingAlbums, albumLink];
singer.fields.albums = mergedAlbums;
await singer.update();
await singer.publish();

And after calling the publish method I’m getting VersionMismatch error:

VersionMismatch: {
  "status": 409,
  "statusText": "Conflict",
  "message": "",
  "details": {},
  "request": {
    "url": "/spaces/.../environments/develop/entries/.../published",
    "headers": {
      "Accept": "application/json, text/plain, */*",
      "Content-Type": "application/",
      "X-Contentful-User-Agent": "sdk contentful-management.js/10.19.3; platform node.js/v18.9.0; os macOS/v18.9.0;",
      "Authorization": "Bearer ...",
      "user-agent": "node.js/v18.9.0",
      "Accept-Encoding": "gzip",
      "X-Contentful-Version": 40
    "method": "put",
    "payloadData": null
  "requestId": "..."

If I remove publish method, everything goes fine, but the singer entry stays in changed status and I have to publish it manually.

As I understood from the docs, the reason is the wrong X-Contentful-Version header value, but I don’t set it. And even I didn’t find the way to set it with the contentful-management lib.

How do I fix it? Should I somehow set the version number explicitly?