tonhowtf/omniget · error · Error

SoundCloud nao retornou URL

Error message

SoundCloud nao retornou URL

What it means

Raised by fetch_access_token when the playbackAccessToken object exists but has no string 'signature' field. The signature is mandatory: it is appended to authenticated clip URLs so Twitch validates the playback token. Without it downloads would be rejected.

Solutions

  1. Dump token_obj and check the actual field names; adjust the lookup (e.g. /sig or nested path) if renamed.
  2. Confirm the token request succeeded upstream (a partial token object often accompanies an error payload).
  3. Add a schema/version check or contract test against the live GQL response.
  4. Treat as a retryable upstream issue if transient; otherwise fail fast with the raw payload logged.

Example fix

// before
let signature = token_obj
    .get("signature")
    .and_then(|v| v.as_str())
    .ok_or_else(|| anyhow!("Token sem signature"))?
    .to_string();
// after
let signature = token_obj.get("signature")
    .and_then(|v| v.as_str())
    .or_else(|| token_obj.pointer("/signature/value").and_then(|v| v.as_str()))
    .ok_or_else(|| anyhow!("Token sem signature: {}", token_obj))? // include payload for diagnosis
    .to_string();
Defensive patterns

Strategy: type-guard

Type guard

fn signature_of(token_obj: &serde_json::Value) -> Option<&str> {
    token_obj.get("signature").and_then(|v| v.as_str()).filter(|s| !s.is_empty())
}

Try / catch

// Guard before URL construction
let Some(signature) = signature_of(&token_obj) else {
    anyhow::bail!("token missing signature: {}", token_obj);
};

Prevention

When it happens

Trigger: token_obj.get("signature").and_then(|v| v.as_str()) returns None — the field is absent, null, or a non-string type in the token object.

Common situations: Twitch renaming or nesting the signature field; token issued in an error/degraded form; response parsed from a mocked/changed endpoint; type change from string to object.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/e5f56901b33759a1. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/study-music/soundcloud-store.svelte.ts:448

    const local = scTrackToMusicTrack(track);
    const localQueue = (queue && queue.length > 0 ? queue : [track]).map(scTrackToMusicTrack);
    await musicPlayer.play(local, localQueue);
  }
}

export const soundcloudStore = new SoundCloudStore();

async function resolveSoundcloudStream(
  track: MusicTrack,
): Promise<{ url: string; is_hls: boolean }> {
  const scId = (track as any).soundcloud_id as number | undefined;
  if (!scId) throw new Error("Track sem soundcloud_id");
  const res = await pluginInvoke<{ url: string; is_hls: boolean }>(
    "study",
    "study:soundcloud:stream:resolve",
    { trackId: scId, quality: "progressive" },
  );
  if (!res.url) throw new Error("SoundCloud nao retornou URL");
  return res;
}

if (typeof window !== "undefined") {
  (musicPlayer as any).soundcloudResolver = resolveSoundcloudStream;
}

View on GitHub (pinned to 8600b91f42)