# Couldn't be able to continueAsNew a child workflow inside the same childWorkflow

**URL:** <https://community.temporal.io/t/couldnt-be-able-to-continueasnew-a-child-workflow-inside-the-same-childworkflow/4877>\
**Category:** Community Support\
**Tags:** typescript-sdk\
**Created:** [June 3, 2022, 12:26pm UTC](https://community.temporal.io/t/couldnt-be-able-to-continueasnew-a-child-workflow-inside-the-same-childworkflow/4877 "2022-06-03T12:26:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muhammad\_Suleman](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/muhammad_suleman/32/2123_2.png) [@Muhammad\_Suleman](https://community.temporal.io/u/Muhammad_Suleman)\
**Post date:** [June 3, 2022, 12:26pm UTC](https://community.temporal.io/t/couldnt-be-able-to-continueasnew-a-child-workflow-inside-the-same-childworkflow/4877/1 "2022-06-03T12:26:03Z")

</div>

**This is the error I am getting**

```auto
[childWorkflow(child-42423-1)] Child Workflow Errr ContinueAsNew: Workflow continued as new
    at eval (webpack-internal:///./node_modules/@temporalio/workflow/lib/workflow.js:651:19)
    at eval (webpack-internal:///./node_modules/@temporalio/workflow/lib/workflow.js:662:16)
    at Object.continueAsNew (webpack-internal:///./node_modules/@temporalio/workflow/lib/workflow.js:691:35)
    at childWorkflow (webpack-internal:///./dist/src/utils/schedule-workflow.js:183:26)
    at Script.runInContext (node:vm:139:12)
    at Object.runInContext (node:vm:289:6)
    at Proxy.<anonymous> (/mnt/d/officework/databashi-worker/node_modules/@temporalio/worker/lib/workflow/vm.js:62:46)
    at VMWorkflow.activate (/mnt/d/officework/databashi-worker/node_modules/@temporalio/worker/lib/workflow/vm.js:176:39)
    at handleRequest (/mnt/d/officework/databashi-worker/node_modules/@temporalio/worker/lib/workflow/workflow-worker-thread.js:45:47)
    at MessagePort.<anonymous> (/mnt/d/officework/databashi-worker/node_modules/@temporalio/worker/lib/workflow/workflow-worker-thread.js:79:38) {
  command: {
    workflowType: 'childWorkflow',
    arguments: [[Object], [Object], [Object], [Object], [Object] ],
    headers: {},
    taskQueue: '3123',
    memo: undefined,
    searchAttributes: undefined,
    workflowRunTimeout: undefined,
    workflowTaskTimeout: undefined
  }
}

```

This is my code for creating child workflow

```auto
async function spawnChild(
  invocation: number,
  fields:any, 
  command: Command
) {
  const childWorkflowOpts = {
    workflowId: `${command.workflowId}-${invocation}`,
    cancellationType: wf.ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED,
    parentClosePolicy: wf.ParentClosePolicy.PARENT_CLOSE_POLICY_ABANDON,
  };

  return startChild(childWorkflow, {
    ...childWorkflowOpts,
    args: [command.workflowId, command.isCron, command.script, invocation, fields],
  });
}

```

 ![image](https://us1.discourse-cdn.com/flex016/uploads/temporal/original/2X/2/2aea7784d7f88cda70b458124a1181f078434ae2.png)  
Long story short… the spawn child method is creating a childWorkflow and function childWorkflow has continueAsNew childWorkflow, but I get the error. I am unable to understand the error and also how to resolve this issue

---

<div class="post-metadata">

**Author:** ![bergundy](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/bergundy/32/900_2.png) [@bergundy](https://community.temporal.io/u/bergundy)\
**Post date:** [June 3, 2022, 9:43pm UTC](https://community.temporal.io/t/couldnt-be-able-to-continueasnew-a-child-workflow-inside-the-same-childworkflow/4877/2 "2022-06-03T21:43:25Z")

</div>

continueAsNew is implemented via throwing a special exception, you should let that exception propagate

---

<div class="post-metadata">

**Author:** ![Muhammad\_Suleman](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/muhammad_suleman/32/2123_2.png) [@Muhammad\_Suleman](https://community.temporal.io/u/Muhammad_Suleman)\
**Post date:** [June 6, 2022, 9:36am UTC](https://community.temporal.io/t/couldnt-be-able-to-continueasnew-a-child-workflow-inside-the-same-childworkflow/4877/3 "2022-06-06T09:36:47Z")

</div>

Thankyou, it worked!
