gitbutlerapp/gitbutler · error · Error

Invalid playlist URL

Error message

Invalid playlist URL

What it means

Thrown in onMount when extractPlaylistId(PLAYLIST_URL) returns falsy. PLAYLIST_URL is a hardcoded constant in the component, so this is a broken build-time constant or a parser/regex regression, not user input; the catch block stores the message and the section renders its error state.

Source

Thrown at apps/web/src/routes/(home)/sections/FeatureUpdates.svelte:147

		return () => {
			clearTimeout(timeoutId);
			carousel?.removeEventListener("scroll", updateScrollState);
		};
	});

	$effect(() => {
		if (playlist && carousel) {
			setTimeout(updateScrollState, 100);
		}
	});

	// Data loading
	onMount(async () => {
		try {
			const playlistId = extractPlaylistId(PLAYLIST_URL);
			if (!playlistId) {
				throw new Error("Invalid playlist URL");
			}

			playlist = await fetchPlaylistVideos(playlistId);
		} catch (err) {
			error = err instanceof Error ? err.message : "Failed to load videos";
			console.error("Error loading playlist:", err);
		} finally {
			isLoading = false;
		}
	});
</script>

<section class="feature-updates">
	<SectionHeader>
		<i>Feature</i> updates

		{#snippet buttons()}
			<div class="feature-updates__all-demos">

View on GitHub (pinned to caf1f223d3)

Solutions

  1. Restore a URL of the form https://youtube.com/playlist?list=<ID> in the PLAYLIST_URL constant.
  2. Add a unit test pinning extractPlaylistId against the exact constant value so edits fail in CI instead of at runtime.
  3. Optionally hide the section when extraction fails rather than showing an error block.

Example fix

// before
const PLAYLIST_URL =
  "https://youtube.com/playlist?list=PLNXkW_le40U7IH8qA5VPN6f01oC25LOj4&si=IRZbd5aBoNLWDH5g";

// after — fail loudly at module load if the constant stops parsing
const PLAYLIST_URL =
  "https://youtube.com/playlist?list=PLNXkW_le40U7IH8qA5VPN6f01oC25LOj4&si=IRZbd5aBoNLWDH5g";
if (!extractPlaylistId(PLAYLIST_URL)) {
  throw new Error("PLAYLIST_URL no longer contains a playlist id — fix the constant");
}
Defensive patterns

Strategy: validation

Validate before calling

const playlistId = extractPlaylistId(PLAYLIST_URL);
if (!playlistId) {
  error = ""; // hide the section instead of showing an error for a constant
  console.error("PLAYLIST_URL is not a valid playlist URL:", PLAYLIST_URL);
  return;
}

Type guard

function isValidPlaylistUrl(url: string): boolean {
  return /[?&]list=[A-Za-z0-9_-]+/.test(url);
}

Try / catch

try {
  const playlistId = extractPlaylistId(PLAYLIST_URL);
  if (!playlistId) throw new Error("Invalid playlist URL");
  playlist = await fetchPlaylistVideos(playlistId);
} catch (err) {
  error = err instanceof Error ? err.message : "Failed to load videos";
}

Prevention

When it happens

Trigger: The PLAYLIST_URL constant was edited and lost its valid list= query parameter, or extractPlaylistId's parsing (in $lib/youtube) changed and no longer matches the URL shape (extra si= param, different host form like youtube.com vs www.youtube.com).

Common situations: Someone swapped the featured-release playlist URL and pasted a watch?v= or channel URL by mistake; youtube helper refactor broke the list-param regex; the marketing playlist moved and the constant was updated with a malformed URL.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/3082737b103cf029. Report an issue: GitHub.