{"record":{"id":"f809daa00960e0a1","repo":"coleam00/Archon","slug":"failed-to-capture-workflow-source-from-effective","errorCode":null,"errorMessage":"Failed to capture workflow source from ${effectiveDiscoveryCwd}: ${(error as Error).message}","messagePattern":"Failed to capture workflow source from (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":1527,"sourceCode":"  // `finalizeWorkflowSource` (workflow.ts:1749) reassigns `preparedSource` to a\n  // new object whose `captureRoot` is the LIVE artifacts directory the run\n  // executes from — rm-ing `preparedSource.captureRoot` on Ctrl-C mid-run would\n  // destroy the run's source. The original staged path is renamed away by\n  // either `finalizeWorkflowSource` (container) or `executeWorkflow`'s rename\n  // (everything else), so an `rm` against it is a no-op once prep has moved it.\n  let originalStagedRoot: string | undefined;\n  if (!isContinuation && !options.dryRun && !options.stubsInitPath) {\n    try {\n      preparedSource = await prepareWorkflowSource(createWorkflowDeps(), {\n        sourceRoot: effectiveDiscoveryCwd,\n        // Keep the capture filed under the run it belongs to when the row already exists.\n        ...(detachedPreCreatedRun ? { runId: detachedPreCreatedRun.id } : {}),\n      });\n      // From here the owner reclaims it unless a run adopts it, whichever way we leave.\n      owner.hold(preparedSource);\n      originalStagedRoot = preparedSource.captureRoot;\n    } catch (error) {\n      throw new Error(\n        `Failed to capture workflow source from ${effectiveDiscoveryCwd}: ${(error as Error).message}`\n      );\n    }\n  }\n\n  // A resolved continuation already discovered over its own roots; reusing that result is\n  // what keeps a resume from paying digest verification and full discovery twice.\n  // Mutable: an adopt lane that runs inside the adopted run's worktree re-freezes and\n  // re-discovers from THAT checkout once its path is known (see recaptureForLane).\n  let { workflows: workflowEntries, errors } = continuation\n    ? { workflows: continuation.workflows, errors: continuation.errors }\n    : preparedSource\n      ? await discoverWorkflowsWithConfig(cwd, loadConfig, preparedSource.roots)\n      : await loadWorkflows(effectiveDiscoveryCwd);\n  const sourceCounts = countWorkflowSources(workflowEntries);\n\n  if (!options.json && !options.quiet) {\n    console.log(","sourceCodeStart":1509,"sourceCodeEnd":1545,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L1509-L1545","documentation":"Error \"Failed to capture workflow source from ${effectiveDiscoveryCwd}: ${(error as Error).message}\" thrown in coleam00/Archon.","triggerScenarios":"Thrown at packages/cli/src/commands/workflow.ts:1527 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}