langgenius/dify · error · WorkflowApplyOrphanError

Failed to apply graph; new app ${orphanAppId} may be orphane

Error message

Failed to apply graph; new app ${orphanAppId} may be orphaned.

What it means

Error "Failed to apply graph; new app ${orphanAppId} may be orphaned." thrown in langgenius/dify.

Source

Thrown at web/app/components/workflow/workflow-generator/apply.ts:131

  // user isn't left with a discoverable-but-empty app sitting at the top
  // of their /apps list. ``deleteApp`` is best-effort — if that also fails
  // (it usually won't, it's a simple DELETE) we surface ``WorkflowApplyOrphanError``
  // so the caller can route to /apps where the orphan is still recoverable
  // by hand.
  try {
    await syncWorkflowDraft({
      url: `apps/${app.id}/workflows/draft`,
      params: {
        graph,
        features: {},
        conversation_variables: [],
      },
    })
  } catch (syncErr) {
    try {
      await deleteApp(app.id)
    } catch (deleteErr) {
      throw new WorkflowApplyOrphanError(app.id, deleteErr)
    }
    throw syncErr
  }

  return { appId: app.id, appMode, permissionKeys: app.permission_keys }
}

type ApplyToCurrentAppParams = {
  appId: string
  graph: GeneratedGraph
}

/**
 * Apply path B — overwrite the current Workflow Studio's draft graph.
 *
 * The backend's ``sync_draft_workflow`` rejects writes whose ``hash`` doesn't
 * match the existing draft's ``unique_hash`` (WorkflowHashNotEqualError), so we
 * must read the current draft first to grab its hash. We also preserve the

View on GitHub (pinned to ef8544b173)

When it happens

Trigger: Thrown at web/app/components/workflow/workflow-generator/apply.ts:131 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/ae4291fdc55ac083. Report an issue: GitHub.