deepseek-ai/deepseek-harness · error · Error

Ralph workflow returned an unknown terminal status

Error message

Ralph workflow returned an unknown terminal status

What it means

readRunResult exhausts the terminal-status discriminant without a match: the fixed script reported a status outside the closed set (complete, blocked, budget-limited, round-failed), so the value cannot be trusted.

Solutions

  1. Return one of the known terminal statuses from the Ralph workflow; add handling for the returned status if a new one was introduced.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/workflow/tool-ralph/src/index.ts:331 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/720b60a84d8a40b3. Report an issue: GitHub.

Appendix: source

Thrown at packages/workflow/tool-ralph/src/index.ts:331

        throw new Error('Ralph workflow returned a malformed terminal result')
      }
      if (roundsStarted === 1) {
        if (value['lastReport'] !== null) {
          throw new Error('Ralph workflow returned an invalid first-round failure')
        }
        return { status: 'round-failed', roundsStarted }
      }
      if (value['lastReport'] === null) {
        throw new Error('Ralph workflow returned a round failure without its last handoff')
      }
      return {
        status: 'round-failed',
        roundsStarted,
        lastReport: readReport(value['lastReport'], 'continue', maxHandoffChars),
      }
    }
    default:
      throw new Error('Ralph workflow returned an unknown terminal status')
  }
}

/** A non-clean workflow finish is an error, never a partial Ralph success. */
function stopReasonError(result: WorkflowResult): string | undefined {
  switch (result.stopReason) {
    case 'completed':
      return undefined
    case 'cancelled':
      return `Ralph workflow was cancelled${result.error === undefined ? '' : ` (${result.error})`}`
    case 'error':
      return `Ralph workflow failed: ${result.error ?? 'unknown error'}`
    /* v8 ignore start -- WorkflowStopReason is closed; a future variant must fail loud here. */
    default:
      return `Ralph workflow ended abnormally (${String(result.stopReason satisfies never)})`
    /* v8 ignore stop */
  }
}

View on GitHub (pinned to b150a551b8)