From 7d17abdbb16421db958b9031bfbf85f32635fe03 Mon Sep 17 00:00:00 2001 From: Alexander Ott <66271487+AlexanderHott@users.noreply.github.com> Date: Mon, 23 Nov 2026 20:11:56 -0800 Subject: [PATCH 1/3] Log the downloader's real error and update yt-dlp to 2026.11.23 A YouTube download on the server failed with only "The source is unavailable, unsupported, or requires authentication." The adapter maps yt-dlp's stderr to that generic message and dropped the original, so the worker logs could not show that YouTube's bot check had blocked the server's IP. The stderr tail now rides along as the error's cause. The worker already logs the whole error, so the yt-dlp line shows up there. Stored rows and users still get only the message. Co-Authored-By: Claude Opus 5.5 --- Dockerfile | 8 +++---- docs/media-downloads.md | 2 +- src/modules/mediaDownloads/policy.ts | 3 ++- .../mediaDownloads/ytDlpAdapter.test.ts | 22 +++++++++++++++++++ src/modules/mediaDownloads/ytDlpAdapter.ts | 11 +++++++++- 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 836520c..303ed6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,11 +57,11 @@ ADD --checksum=sha256:5600024376f572a557870a5eb0afb1e5961636bef4e1e22132025467d0 CMD ["node", ".output/worker/index.mjs"] FROM scratch AS media-tools -ADD --checksum=sha256:58162f9bfdc27458ea47bfcb311cf47028f17d8154a8bf7d689861d46399230a \ - https://github.com/yt-dlp/yt-dlp/releases/download/2026.08.19/yt-dlp_linux \ +ADD --checksum=sha256:249ddb058234276bc449b9cd9492aad9f133bda5923c61a9e39983ae114ef17d \ + https://github.com/yt-dlp/yt-dlp/releases/download/2026.11.23/yt-dlp_linux \ /yt-dlp-amd64 -ADD --checksum=sha256:b16e4dab368a816cd05d477d698a605a6ae87ccee1c8ffd38fa21d7254141fcc \ - https://github.com/yt-dlp/yt-dlp/releases/download/2026.08.19/yt-dlp_linux_aarch64 \ +ADD --checksum=sha256:fb847a2e4a9ddc8cf5fcfb4bb7f42ba8969ecf72068def0278074f9d300bd13c \ + https://github.com/yt-dlp/yt-dlp/releases/download/2026.11.23/yt-dlp_linux_aarch64 \ /yt-dlp-arm64 FROM runtime AS media-worker diff --git a/docs/media-downloads.md b/docs/media-downloads.md index 2d28b4c..b8a17e1 100644 --- a/docs/media-downloads.md +++ b/docs/media-downloads.md @@ -28,7 +28,7 @@ Live streams, authenticated sources, private playlists, ZIP exports, and subscri ## Running the worker -Compose builds the `media-worker` target for amd64 or arm64. It includes yt-dlp 2026.08.19, ffmpeg, ffprobe, and Node. yt-dlp release downloads are checksum-verified. Update the version and both checksums in `Dockerfile` together when upgrading. +Compose builds the `media-worker` target for amd64 or arm64. It includes yt-dlp 2026.11.23, ffmpeg, ffprobe, and Node. yt-dlp release downloads are checksum-verified. Update the version and both checksums in `Dockerfile` together when upgrading. The worker has a separate disk volume, `media_scratch`, and does not load the background-removal model. Budget at least 16 GB of free disk for scratch data plus space for RustFS outputs. The scratch limit is monitored per task; the named volume does not impose a filesystem quota. The worker runs as `nobody` with a 2 GB memory limit and two CPUs in Compose. diff --git a/src/modules/mediaDownloads/policy.ts b/src/modules/mediaDownloads/policy.ts index 3ba0bd4..78dcf20 100644 --- a/src/modules/mediaDownloads/policy.ts +++ b/src/modules/mediaDownloads/policy.ts @@ -52,8 +52,9 @@ export class MediaError extends Error { constructor( public readonly code: "unavailable" | "needs_selection" | "limit" | "network" | "worker_lost", message: string, + options?: ErrorOptions, ) { - super(message); + super(message, options); } } diff --git a/src/modules/mediaDownloads/ytDlpAdapter.test.ts b/src/modules/mediaDownloads/ytDlpAdapter.test.ts index 0cd406c..4f5c83c 100644 --- a/src/modules/mediaDownloads/ytDlpAdapter.test.ts +++ b/src/modules/mediaDownloads/ytDlpAdapter.test.ts @@ -109,6 +109,28 @@ test("cancellation stops subprocess descendants", async () => { } }); +test("failures keep the downloader's stderr as the cause for worker logs", async () => { + const cwd = await mkdtemp(join(tmpdir(), "bg-process-test-")); + const stderr = "ERROR: [youtube] abc: Sign in to confirm you're not a bot."; + try { + const failure = runMediaProcess({ + executable: process.execPath, + args: ["-e", `console.error(${JSON.stringify(stderr)}); process.exit(1)`], + cwd, + signal: new AbortController().signal, + timeoutMs: 5_000, + onLine: async () => {}, + }); + await expect(failure).rejects.toMatchObject({ + code: "unavailable", + message: "The source is unavailable, unsupported, or requires authentication.", + cause: stderr, + }); + } finally { + await rm(cwd, { recursive: true, force: true }); + } +}); + test("a failed metadata consumer stops the producer", async () => { const cwd = await mkdtemp(join(tmpdir(), "bg-process-test-")); try { diff --git a/src/modules/mediaDownloads/ytDlpAdapter.ts b/src/modules/mediaDownloads/ytDlpAdapter.ts index 904592c..702d4bc 100644 --- a/src/modules/mediaDownloads/ytDlpAdapter.ts +++ b/src/modules/mediaDownloads/ytDlpAdapter.ts @@ -89,11 +89,14 @@ export function normalizeMetadata(value: unknown): MediaMetadata { }; } +/** Maps process stderr to a user-facing error, keeping the raw tail as `cause` for worker logs. */ function failureFromOutput(output: string) { + const options = { cause: output.trim() }; if (/Requested format is not available/i.test(output)) return new MediaError( "needs_selection", "The selected format is no longer available. Refresh formats and choose again.", + options, ); if ( /unavailable|private video|removed|not available|sign in|unsupported url|no video formats|copyright|HTTP Error 403|HTTP Error 404/i.test( @@ -103,12 +106,18 @@ function failureFromOutput(output: string) { return new MediaError( "unavailable", "The source is unavailable, unsupported, or requires authentication.", + options, ); if (/larger than max|File too large|No space left/i.test(output)) - return new MediaError("limit", "The media exceeds the download or scratch-disk limit."); + return new MediaError( + "limit", + "The media exceeds the download or scratch-disk limit.", + options, + ); return new MediaError( "network", "The source could not be downloaded. It may be temporarily unavailable or rate limited.", + options, ); } From cf599d58e02a2f2dfb36c109fd3af78619b6e138 Mon Sep 17 00:00:00 2001 From: Alexander Ott <66271487+AlexanderHott@users.noreply.github.com> Date: Mon, 23 Nov 2026 20:11:56 -0800 Subject: [PATCH 2/3] Stop the auth forms and download settings overflowing on phones On a short landscape screen the sign-up form was taller than its h-full wrapper and its top was cut off above the scroll area. The download settings fieldset kept its min-content width and spilled out of its card at 375px. Co-Authored-By: Claude Opus 5.5 --- src/modules/mediaDownloads/components/DownloadSettings.tsx | 5 ++++- src/routes/_auth/sign-in.tsx | 2 +- src/routes/_auth/sign-up.tsx | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/modules/mediaDownloads/components/DownloadSettings.tsx b/src/modules/mediaDownloads/components/DownloadSettings.tsx index 0558796..4b4728b 100644 --- a/src/modules/mediaDownloads/components/DownloadSettings.tsx +++ b/src/modules/mediaDownloads/components/DownloadSettings.tsx @@ -9,7 +9,10 @@ export function BatchSettings(props: { simple?: boolean; }) { return ( -
+