{"record":{"id":"ca75425b2520e9e9","repo":"tonhowtf/omniget","slug":"video-restore","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/video_restore.rs","lineNumber":224,"sourceCode":"            &opts.preset,\n            \"-crf\",\n            &opts.crf.clamp(10, 40).to_string(),\n            \"-c:a\",\n            \"copy\",\n            \"-movflags\",\n            \"+faststart\",\n        ])\n        .arg(&output)\n        .output()\n        .await\n        .map_err(|e| anyhow!(\"ffmpeg nao iniciou: {}\", e))?;\n    if let Some(file) = trf.as_ref() {\n        if let Some(dir) = file.parent() {\n            let _ = std::fs::remove_dir_all(dir);\n        }\n    }\n    if !out.status.success() {\n        return Err(anyhow!(\"{}\", String::from_utf8_lossy(&out.stderr).trim()));\n    }\n\n    Ok(RestoreItem {\n        input: input.to_string(),\n        output: Some(output.to_string_lossy().to_string()),\n        filter,\n        bytes_before,\n        bytes_after: std::fs::metadata(&output).map(|m| m.len()).unwrap_or(0),\n        stabilized: opts.stabilize,\n        ok: true,\n        error: None,\n    })\n}\n\npub async fn run(\n    opts: RestoreOptions,\n    progress: super::ProgressFn,\n) -> anyhow::Result<RestoreResult> {","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/video_restore.rs#L206-L242","documentation":"Raised when the final ffmpeg render pass in restore_one exits with non-zero status (video_restore.rs:224). The message is the raw trimmed ffmpeg stderr with no prefix. The transform file's temp directory is cleaned up first, then the error propagates. This means ffmpeg ran but failed during stabilization/encode.","triggerScenarios":"Second ffmpeg pass (using the .trf transforms file produced by detection) exits non-zero: disk full while writing output, unreadable .trf file, codec/encoder unavailable, or output path not writable.","commonSituations":"Insufficient disk space for a large re-encode; output directory lacking write permission; ffmpeg build lacking the target encoder (e.g., libx264); trf file deleted by a concurrent cleanup.","solutions":["Read the embedded ffmpeg stderr — it pinpoints encode, I/O, or filter failures.","Check free disk space at the output location and ensure the output path is writable.","Verify the encoder exists (`ffmpeg -encoders | grep 264` or your target codec) and install a full ffmpeg build.","Re-run the restore so detection regenerates a fresh .trf file."],"exampleFix":"// before: bare stderr\nreturn Err(anyhow!(\"{}\", String::from_utf8_lossy(&out.stderr).trim()));\n// after: context helps callers\nreturn Err(anyhow!(\"falha ao estabilizar '{}': {}\", input.display(), String::from_utf8_lossy(&out.stderr).trim()));","handlingStrategy":"validation","validationCode":"let meta = std::fs::metadata(output.parent().unwrap())?;\nlet avail = fs4::available_space(output.parent().unwrap())?;\nif avail < estimated_output_size {\n    return Err(anyhow!(\"espaço insuficiente em disco para a saída\"));\n}","typeGuard":null,"tryCatchPattern":"match restore_one(input).await {\n    Err(e) => {\n        let detail = e.to_string();\n        if detail.contains(\"No space left\") { eprintln!(\"libere espaço em disco e tente de novo\"); }\n        else if detail.contains(\"Unknown encoder\") { eprintln!(\"instale um ffmpeg com o codec necessário\"); }\n        else { eprintln!(\"falha no render: {detail}\"); }\n    }\n    Ok(item) => item,\n}","preventionTips":["Check free disk space before starting a re-encode","Verify required encoders exist in the installed ffmpeg build","Keep output directories writable by the app user","Regenerate the .trf file fresh on every retry"],"tags":["ffmpeg","encode-failure","video-restore","external-process"],"backgroundTag":"http-error-response","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}