From 8f67d6a1aa2198b41104e796f10ea1146579684f Mon Sep 17 00:00:00 2001 From: fspecii <4722521+fspecii@users.noreply.github.com> Date: Mon, 2 Mar 2026 18:12:57 +0200 Subject: [PATCH] Validate source audio is loadable before cover/repaint generation When prepareAudioFile fails (file not found), it was returning null silently. For cover and repaint modes this caused Gradio to run without source audio, generating a short/empty/silent result instead of failing with a clear error message. --- server/src/services/acestep.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/src/services/acestep.ts b/server/src/services/acestep.ts index a8a40d4..36680f5 100644 --- a/server/src/services/acestep.ts +++ b/server/src/services/acestep.ts @@ -141,6 +141,12 @@ async function buildGradioArgs(params: GenerationParams): Promise { const referenceAudio = await prepareAudioFile(params.referenceAudioUrl); const sourceAudio = await prepareAudioFile(params.sourceAudioUrl); + // Guard: cover/repaint modes require source audio to be loadable + const needsSource = params.taskType === 'cover' || params.taskType === 'audio2audio' || params.taskType === 'repaint'; + if (needsSource && params.sourceAudioUrl && sourceAudio === null) { + throw new Error(`Source audio file could not be loaded from: ${params.sourceAudioUrl}. Make sure the file was uploaded successfully.`); + } + // CoT features are gated by enhance OR thinking (either enables LLM enrichment) const useCot = isEnhance || isThinking;