You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Transcript cleanup fails with invalid structured output when the cleanup model does not enforce the schema #32049
Transcript cleanup never succeeds when the cleanup model is an OpenCode (or Antigravity) model. Each dictation ended with the "Transcript cleanup failed" toast and the raw transcript was inserted. In one session four attempts failed and none succeeded; durations were 90.5s, 3.8s, 7.2s and 6.1s.
Diagnosis
The cleanup prompt and the operation's output contract disagree.
apps/server/src/textGeneration/TranscriptionPostProcessing.ts:32 ends the prompt with "Return only the cleaned transcript" (plain text).
packages/provider-core/src/server/textGenerationOperations.ts:22 declares TranscriptionPostProcessingOutput = Schema.Struct({ transcription: Schema.String }), and decodeJsonReply (line 56) parses the reply as JSON.
Codex (--output-schema) and Claude (structured output) enforce the schema natively, so the mismatch never shows there. OpenCode2 and Antigravity only prepend "Return only the requested JSON object" to the prompt, so the model answers with plain text and decoding fails with SchemaError: Expected a valid JSON string / "invalid structured output".
The schema and operation were added in #30625 (commit b8dce83) without updating the prompt. The bug is still on main.
Steps to reproduce
Set the transcript cleanup model (Settings -> Voice -> Cleanup) to an OpenCode or Antigravity model.
Turn on "Clean up transcripts with a provider".
Dictate one sentence and stop.
Cleanup fails after 4-90s; server.trace.ndjson records SpeechPostProcessing.process as Failure with "invalid structured output".
Version
0.1.8-nightly.20261106.4262 (server commit c55db3e); still present on main as of 2026-11-06
Environment
Fedora Linux 44 (KDE Plasma), T3 Code desktop app with a local server, Intel i5-8350U, Intel UHD Graphics 620 (Vulkan), 15 GB RAM, parakeet-unified-en-0.6b-Q8_0
Evidence
SpeechPostProcessing.process spans, all four failed:
19:20:45 90545 ms Failure
19:22:37 3808 ms Failure
19:23:15 7230 ms Failure
19:25:28 6123 ms Failure
Cause: TextGenerationError: Text generation failed in generateTranscriptionPostProcessing: invalid structured output
SchemaError: Expected a valid JSON string
Related issues
#30625 added the JSON output schema and the operation. No existing issue reports this failure.
Fix applied or workaround
Disable transcript cleanup, or set the cleanup model to Codex/Claude, which enforce the schema natively.
Filed by
opencode/deepseek-v4.1-flash-free via the OpenCode harness (T3 Code triage)
Confirming this still reproduces on 0.1.12-nightly.20261121.5038 (Linux x64 desktop app with local server; triage CLI 0.1.11), failing 100% of the time with both OpenCode (google-vertex/openai/gpt-oss-120b-maas) and Antigravity models configured as the transcript cleanup model.
Evidence (server.trace.ndjson)
6 consecutive SpeechPostProcessing.process attempts (4 OpenCode, 2 Antigravity) all failed with SchemaError: Expected a valid JSON string:
# OpenCode (OpenCode2TextGeneration.generateTranscriptionPostProcessing)
2026-11-21T14:15:29Z 16022.6ms Failure TextGenerationError: OpenCode returned invalid structured output. [cause]: SchemaError: Expected a valid JSON string
2026-11-21T14:22:47Z 19182.3ms Failure TextGenerationError: OpenCode returned invalid structured output. [cause]: SchemaError: Expected a valid JSON string
2026-11-21T15:33:48Z 12751.0ms Failure TextGenerationError: OpenCode returned invalid structured output. [cause]: SchemaError: Expected a valid JSON string
2026-11-21T15:39:34Z 15072.1ms Failure TextGenerationError: OpenCode returned invalid structured output. [cause]: SchemaError: Expected a valid JSON string
# Antigravity (AntigravityTextGeneration.runJson -> generateTranscriptionPostProcessing)
2026-11-21T15:53:58Z 59604.2ms Failure TextGenerationError: Antigravity returned invalid structured output. [cause]: SchemaError: Expected a valid JSON string
2026-11-21T15:58:12Z 39227.9ms Failure TextGenerationError: Antigravity returned invalid structured output. [cause]: SchemaError: Expected a valid JSON string
On the user side, each failure only surfaced the generic "Transcript cleanup failed / The original transcript was added." toast with no reason shown (filing a separate issue for that error-surfacing gap).
Submitted via t3 triage using Gemini 4 Neon (High) in Antigravity.
Confirming this also affects custom openaiCompatible text generators (e.g. a local OpenAI-compatible proxy running deepseek-v4.1-flash):
apps/server/src/textGeneration/textGeneratorDrivers.ts (openAICompatible) sends only { model, messages } without response_format.
Because TranscriptionPostProcessing.ts asks for plain text (Return only the cleaned transcript.), the model returns plain text and generateTranscriptionPostProcessing fails 100% of the time with SchemaError: Expected a valid JSON string (while generateThreadTitle succeeds on the same endpoint).
Workaround until fix(server): transcription cleanup asks for the JSON reply it decodes #32046 is merged: switching Voice → Cleanup → Instructions to Custom and replacing the final sentence with Return ONLY a valid JSON object with the exact shape {"transcription": "<cleaned transcript>"}. fixes it immediately.
Looks like #32046 already has the right fix for this (and adding optional response_format support to openAICompatible would make it even more resilient).
Confirming this also affects the Pi provider (PiTextGeneration) on 0.1.14-nightly.20261127.5319 (macOS arm64, Pi 1.6.1), with the cleanup model set to the Pi model github-copilot/mai-code-2-flash (thinking low).
TextGenerationError: Text generation failed in generateTranscriptionPostProcessing: Pi returned invalid structured output.
at PiTextGeneration.runPiJson
at PiTextGeneration.generateTranscriptionPostProcessing
cause: { _tag: "SchemaError", message: "Expected a valid JSON string" }
The cause is the same: PiTextGeneration.runPiJson sends the prompt as is over Pi RPC (no schema enforcement), takes get_last_assistant_text, and passes it to decodeJsonReply. The cleanup prompt asks for plain text, so Pi returns plain text and decoding fails. Other Pi text-generation operations work because their prompts ask for JSON. #32046 should fix Pi as well, because the change is in the prompt and does not depend on the provider.
Activity
MayankXDev13 commentedon Nov 21, 2026
Confirming this still reproduces on
0.1.12-nightly.20261121.5038(Linux x64 desktop app with local server; triage CLI0.1.11), failing 100% of the time with both OpenCode (google-vertex/openai/gpt-oss-120b-maas) and Antigravity models configured as the transcript cleanup model.Evidence (
server.trace.ndjson)6 consecutive
SpeechPostProcessing.processattempts (4 OpenCode, 2 Antigravity) all failed withSchemaError: Expected a valid JSON string:On the user side, each failure only surfaced the generic
"Transcript cleanup failed / The original transcript was added."toast with no reason shown (filing a separate issue for that error-surfacing gap).Submitted via
t3 triageusing Gemini 4 Neon (High) in Antigravity.Zandaland commentedon Nov 24, 2026
Confirming this also affects custom
openaiCompatibletext generators (e.g. a local OpenAI-compatible proxy runningdeepseek-v4.1-flash):apps/server/src/textGeneration/textGeneratorDrivers.ts(openAICompatible) sends only{ model, messages }withoutresponse_format.TranscriptionPostProcessing.tsasks for plain text (Return only the cleaned transcript.), the model returns plain text andgenerateTranscriptionPostProcessingfails 100% of the time withSchemaError: Expected a valid JSON string(whilegenerateThreadTitlesucceeds on the same endpoint).Return ONLY a valid JSON object with the exact shape {"transcription": "<cleaned transcript>"}.fixes it immediately.Looks like #32046 already has the right fix for this (and adding optional
response_formatsupport toopenAICompatiblewould make it even more resilient).pWoLiAn commentedon Nov 27, 2026
Confirming this also affects the Pi provider (
PiTextGeneration) on0.1.14-nightly.20261127.5319(macOS arm64, Pi1.6.1), with the cleanup model set to the Pi modelgithub-copilot/mai-code-2-flash(thinkinglow).server.trace.ndjson(2026-11-27T06:50:15Z, 5.9 s):The cause is the same:
PiTextGeneration.runPiJsonsends the prompt as is over Pi RPC (no schema enforcement), takesget_last_assistant_text, and passes it todecodeJsonReply. The cleanup prompt asks for plain text, so Pi returns plain text and decoding fails. Other Pi text-generation operations work because their prompts ask for JSON. #32046 should fix Pi as well, because the change is in the prompt and does not depend on the provider.