How to prevent Continuedasnewworkflow and let the workflow fail?

Currently when my workflow fails and after exhausting all the retries, I see a new workflow starts with the same wfid but with different run ID.

I don’t want that.

I want my workflow to be marked as failed post its retries. How to disable Continuedasnewworkflow ?

I assume you have RetryOptions defined on your WorkflowOptions for that workflow.

If your workflow has an set retry policy it is retried up to the set WorkflowExecutionTimeout, or up to maximumAttempts set on its retry policy.
Each workflow retry is going to produce a new workflow run and in Web UI you will see the Continuedasnew status of the previous retry. Note that on each workflow retry the entire workflow is executed from the beginning, thus the new run with a new run id.

If you don’t want this to happen, you should make sure that your workflows do not fail on intermittent errors and you should gracefully handle activity errors for example, rather than retrying the entire workflow.
If you do not specify a retry policy on your WorkflowOptions workflow retries should not happen.This is different than for activities, which do have automatic retries.