diegosouzapw/OmniRoute · error · Error
stepData.error ?? "Translate failed"
Error message
stepData.error ?? "Translate failed"
What it means
Direct-translation failure: when source or target is 'openai' (no hub needed), the single POST to /api/translator/translate with step='direct' returned success !== true or non-ok; the thrown message is stepData.error (sanitized reason) or the fixed 'Translate failed'. No translated JSON was produced for the panel.
Solutions
- Read stepData.error for the conversion-specific reason
- Verify source/target format selection matches the input body
- Retry after correcting the input payload
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src/app/(dashboard)/dashboard/translator/hooks/useTranslateSession.tsx:137 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/2a2fcb2cc34cc41e.
Report an issue: GitHub.
Appendix: source
Thrown at src/app/(dashboard)/dashboard/translator/hooks/useTranslateSession.tsx:137
translatedJson = JSON.stringify(step2Data.result, null, 2);
pipelinePath = "hub-and-spoke";
} else {
const stepDirect = await fetch("/api/translator/translate", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
step: "direct",
sourceFormat: source,
targetFormat: target,
body: parsed,
}),
});
const stepData = (await stepDirect.json()) as {
success: boolean;
result?: Record<string, unknown>;
error?: string;
};
if (!stepData.success) throw new Error(stepData.error ?? "Translate failed");
translatedResult = stepData.result as Record<string, unknown>;
translatedJson = JSON.stringify(stepData.result, null, 2);
pipelinePath = "direct";
}
} else {
translatedJson = JSON.stringify(parsed, null, 2);
}
let responsePreview: string | null = null;
// 4. Optional send (mode === "send").
if (mode === "send") {
setResult((prev) => ({
...prev,
detected,
translatedJson,
intermediateJson,
pipelinePath,View on GitHub (pinned to a179ffed5b)