{"record":{"id":"eea51c99bf79f4c3","repo":"coleam00/Archon","slug":"workflow-did-not-produce-a-result","errorCode":null,"errorMessage":"Workflow did not produce a result.","messagePattern":"Workflow did not produce a result\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":3188,"sourceCode":"        );\n        containerTeardownError = destroyErr as Error;\n      }\n    }\n  }\n\n  // A container teardown failure on an otherwise-SUCCESSFUL run must fail the CLI\n  // (non-zero exit) — a leaked privileged container is not a success. On a failed\n  // run the workflow-failed error below already exits non-zero (the leak was\n  // logged loudly above), so don't mask it.\n  if (containerTeardownError && result?.success) {\n    throw containerTeardownError;\n  }\n\n  if (!result) {\n    // executeWorkflow threw and it was re-thrown out of the try; this line is\n    // unreachable in practice (the throw propagates), but it satisfies the\n    // narrowing for the terminal-result checks below.\n    throw new Error('Workflow did not produce a result.');\n  }\n\n  // Check result and exit appropriately\n  if (result.success && 'paused' in result && result.paused) {\n    console.log('\\nWorkflow paused — waiting for approval.');\n  } else if (result.success) {\n    // Surface workflow result to Web UI as a result card (mirrors orchestrator.ts result message).\n    // Paused workflows are handled in the branch above and intentionally do not get a result card.\n    if ('summary' in result && result.summary) {\n      try {\n        await adapter.sendMessage(conversationId, result.summary, {\n          category: 'workflow_result',\n          segment: 'new',\n          workflowResult: { workflowName: workflow.name, runId: result.workflowRunId },\n        });\n      } catch (surfaceError) {\n        getLog().warn(\n          { err: surfaceError as Error, conversationId },","sourceCodeStart":3170,"sourceCodeEnd":3206,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L3170-L3206","documentation":"After `executeWorkflow` returns, the CLI narrows `result` before checking terminal status; if it is somehow undefined the guard throws 'Workflow did not produce a result.' Per the inline comment this is practically unreachable — executeWorkflow throws on failure — and exists to satisfy TypeScript narrowing for the terminal-result checks.","triggerScenarios":"Only if executeWorkflow returns undefined/null without throwing, which the current implementation should never do; this is a defensive invariant guard.","commonSituations":"Reachable only via an upstream regression where the executor's success path returns void (e.g., a refactor dropping the return value) — seeing it in the wild indicates a bug.","solutions":["File a bug with log output; the executor must either throw or return a result.","Check for local modifications or version mismatches in the workflow executor package.","Re-run the workflow; a one-off engine fault could theoretically skip result construction."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// treat a void return as an engine contract violation\nconst result = await executeWorkflow(...);\nif (result !== undefined && typeof result.success !== 'boolean') {\n  throw new Error('executeWorkflow returned a malformed result');\n}","typeGuard":"function isWorkflowResult(r: unknown): r is { success: boolean; error?: string | null; paused?: boolean } {\n  return typeof r === 'object' && r !== null && typeof (r as { success?: unknown }).success === 'boolean';\n}","tryCatchPattern":"const result = await executeWorkflow(...);\nif (!isWorkflowResult(result)) {\n  getLog().error({}, 'cli.workflow_missing_result');\n  throw new Error('Workflow did not produce a result.');\n}","preventionTips":["Keep executeWorkflow's return contract explicit in its type signature; never return void on the success path.","Add a return-type test so refactors cannot silently drop the result.","Report occurrences as engine bugs with full logs."],"tags":["invariant","typescript","narrowing"],"backgroundTag":"missing-result-value","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}