{"record":{"id":"953a146214a8d9f9","repo":"Hmbown/CodeWhale","slug":"screen-recorder-produced-no-video","errorCode":null,"errorMessage":"screen recorder produced no video","messagePattern":"screen recorder produced no video","errorType":"exception","errorClass":"ExecError","httpStatus":null,"severity":"error","filePath":"crates/tui/plugins/computer-use/src/backends/darwin.mjs","lineNumber":692,"sourceCode":"    } catch (error) {\n      requestRecordingStop(recording);\n      const result = await waitForRecordingStop(recording, 2_000);\n      if (result.terminated !== false) rec.delete(id);\n      throw error;\n    } finally {\n      clearTimeout(timer);\n      signal?.removeEventListener(\"abort\", abort);\n    }\n  }\n\n  async function recordingStop({ id }) {\n    const r = rec.get(id);\n    if (!r) throw new ExecError(`unknown or already-finished recording \"${id}\"`);\n    requestRecordingStop(r);\n    const result = await waitForRecordingStop(r, 20_000);\n    if (result.code !== 0) throw new ExecError(result.error || \"screen recorder failed; partial file retained\");\n    const size = fs.existsSync(r.file) ? fs.statSync(r.file).size : 0;\n    if (!size) throw new ExecError(\"screen recorder produced no video\");\n    rec.delete(id);\n    return { id, file: r.file, mp4: null, bytes: size, mode: r.mode, startedAt: r.startedAt, stoppedAt: new Date().toISOString() };\n  }\n\n  async function closeSession() {\n    // The preview this session showed must not outlive the session; a panel\n    // from a dead session has no owner to refresh or hide it.\n    stopPreviewLoop();\n    await quiescePreview();\n    if (state.previewEnabled && state.inputApp) {\n      try { await native(\"preview_notify\", { enabled: false }); } catch { /* hiding is best-effort */ }\n    }\n    state.previewEnabled = false;\n    await browser.close().catch(() => {});\n    const owned = [...rec.entries()];\n    for (const [, recording] of owned) requestRecordingStop(recording);\n    const results = await Promise.all(owned.map(async ([id, recording]) => {\n      const result = await waitForRecordingStop(recording, 2_000);","sourceCodeStart":674,"sourceCodeEnd":710,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/plugins/computer-use/src/backends/darwin.mjs#L674-L710","documentation":"recordingStop verifies that the output video file exists and is non-empty after the recorder exits cleanly; if the file is missing or zero bytes, the recording produced no usable video and the library throws instead of returning an empty result.","triggerScenarios":"Stopping a recording where the recorder exited with code 0 but wrote nothing — e.g. recording started and stopped almost instantly, a race where the capture never began, or the output path was unwritable/cleaned up before stat.","commonSituations":"Start/stop called back-to-back in a script with no capture duration; a display with no content selected; disk-full or sandboxed temp directory silently swallowing output; a recorder upgrade changing output semantics.","solutions":["Ensure some real duration between recording start and stop (record at least a few seconds).","Check disk space and that the output directory is writable.","Verify the intended display/window exists at start time (switch_display/list_displays).","Retry the recording; if persistent, run the recorder command manually to inspect its behavior with zero-length output."],"exampleFix":"// before\nawait backend.recordingStart({}); await backend.recordingStop({ id });\n// after\nawait backend.recordingStart({});\nawait new Promise(r => setTimeout(r, 3000));\nconst out = await backend.recordingStop({ id });","handlingStrategy":"retry","validationCode":"null","typeGuard":null,"tryCatchPattern":"try {\n  const out = await backend.recordingStop({ id });\n} catch (e) {\n  if (e.message === 'screen recorder produced no video') {\n    // discard, then re-record with a guaranteed minimum duration\n  } else throw e;\n}","preventionTips":["Enforce a minimum recording duration (several seconds) between start and stop.","Ensure the output directory is writable and has free space before starting.","Verify the target display exists (list_displays) before recording it."],"tags":["screen-recording","empty-output","macos"],"backgroundTag":"empty-result-set","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}