Skip to content

IModelClient.iModel.clone sometimes results in 409 exception incorrectly. #342

@ashar-bentley

Description

@ashar-bentley

This issue is random. Most of the time the request succeeds, while it fails at other times. Called as follows in OS+:

  const clonedIModel = await iModelsClient.iModels.clone({
    authorization,
    iModelId,
    iModelProperties: { iTwinId, name, description, changesetId: lastChangeset.value.id },
  });

Resulting Exception:

  code:  'iModelExists'
  details: undefined
  message: 'iModel with the same name already exists within the iTwin.'
  name: 'iModelExists'
  originalError:
        AxiosError: Request failed with status code 409\n    at settle2 (/backend-bundle.js:16380:16)\n    at IncomingMessage.handleStreamEnd (backend-bundle.js:17388:15)\n    at IncomingMessage.emit (node:events:531:35)\n    at endReadableNT (node:internal/streams/readable:1698:12)\n    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)\n    at Axios3.request (backend-bundle.js:18265:45)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async _AxiosRestClient.executeWithRetry (backend-bundle.js:507751:20)\n    at async _AxiosRestClient.executeRequest (backend-bundle.js:507741:26)\n
  statusCode: 409
  stack: 'iModelExists: iModel with the same name already exists within the iTwin.\n    at _IModelsErrorParser.parse (backend-bundle.js:507350:16)\n    at _IModelsErrorParser.parse (backend-bundle.js:510715:63)\n    at Object.parseErrorFunc (backend-bundle.js:511731:86)\n'

Even after the exception, the clone is successful as the iModel with the name provided exists.

This might have to do with the fact that axios is being used by the client and is configured with a retry where the initial call might be timing out and a retry request results in a 409.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions