tonhowtf/omniget · error
o replay nao esta ligado
Error message
o replay nao esta ligado
What it means
save_replay stitches the last N ring-buffer segments into a replay file, but this only works while a screen recording session is active. If the SESSION mutex holds no session (recording was never started or already stopped), the function fails immediately with 'o replay nao esta ligado' (replay is not on). It is a guard against calling replay-only APIs outside an active recording.
Solutions
- Start a recording session (with replay enabled) before calling save_replay.
- Check session state in the UI and disable the replay action when not recording.
- If recording should still be active, check whether stop/cleanup was called earlier or the process restarted and re-record.
Example fix
// before
let out = save_replay().await?;
// after
if !is_recording() {
anyhow::bail!("inicie a gravacao antes de salvar o replay");
}
let out = save_replay().await?; Defensive patterns
Strategy: try-catch
Validate before calling
// Rust
fn replay_available() -> bool {
SESSION.lock().unwrap_or_else(|e| e.into_inner())
.as_ref().map(|s| s.ring_dir.is_some()).unwrap_or(false)
} Type guard
fn has_active_replay_session(s: &Option<Session>) -> bool {
s.as_ref().map(|s| s.ring_dir.is_some()).unwrap_or(false)
} Try / catch
match save_replay().await {
Ok(path) => println!("replay salvo: {path}"),
Err(e) if e.to_string().contains("replay nao esta ligado") => {
eprintln!("inicie uma gravacao com replay antes de salvar");
}
Err(e) => return Err(e),
} Prevention
- Track recording state in the UI and disable replay actions when idle
- Check session liveness before any replay call
- Handle process restarts by resetting UI action availability
When it happens
Trigger: Calling the public save_replay() async function when SESSION.lock() returns None — i.e. no start of recording has happened in this process, or the session was already torn down by a stop call.
Common situations: Frontend invokes the replay command before the user pressed record; recording stopped asynchronously (crash/cleanup) but the UI still allows the replay button; a stale window/process calls replay after a restart of the backend.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- a gravacao atual nao e um replay
- ainda nao ha nada no buffer
- Track sem soundcloud_id
- SoundCloud nao retornou URL
- Spotify SDK device not ready
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/984d604030cc9d61.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/screen_record.rs:440
};
stop_child(sess.child).await;
if let Some(out) = &sess.output {
*LAST_SAVED.lock().unwrap_or_else(|e| e.into_inner()) =
Some(out.to_string_lossy().to_string());
}
if let Some(r) = &sess.ring_dir {
let _ = std::fs::remove_dir_all(r);
}
Ok(state())
}
/// Replay: junta os últimos segmentos num arquivo na pasta de saída, sem
/// interromper a gravação do anel.
pub async fn save_replay() -> anyhow::Result<String> {
let (ring, opts) = {
let s = SESSION.lock().unwrap_or_else(|e| e.into_inner());
let Some(sess) = s.as_ref() else {
return Err(anyhow!("o replay nao esta ligado"));
};
let Some(r) = sess.ring_dir.clone() else {
return Err(anyhow!("a gravacao atual nao e um replay"));
};
(r, sess.opts.clone())
};
let ffmpeg = crate::core::dependencies::ensure_ffmpeg().await?;
let mut segs: Vec<(std::time::SystemTime, PathBuf)> = std::fs::read_dir(&ring)?
.flatten()
.filter_map(|e| {
let p = e.path();
let m = e.metadata().ok()?;
if p.extension().map(|x| x == "mp4").unwrap_or(false) && m.len() > 0 {
Some((m.modified().ok()?, p))
} else {
None
}
})View on GitHub (pinned to 8600b91f42)