---
name: suno-api-repair
description: Diagnose and repair the WAV Exporter for Suno Chrome extension (and the suno-download script) when Suno changes its API or site, then ship a fixed version. Use when exports suddenly fail, the extension's Doctor panel shows a red probe, users report "no token", "billing unreadable", "listing failed", "convert_wav HTTP 4xx", "WAV render did not finish", or size/verification errors, when the owner says Suno changed something, or invokes "/suno-api-repair". Runs the offline gates, a zero-cost live API shape probe (scripts/api-probe.mjs) against the owner's signed-in profile, maps each broken field to the code that reads it, repairs with a failing test first, and prepares the release zip for the owner to upload.
---
# suno-api-repair — diagnose, repair, re-release
The extension talks to Suno through **a handful of endpoints, the token capture in the page, and
the host that serves the WAV bytes**. When Suno changes any of them, a run fails. This skill works
out which one moved and fixes the code that reads it. The fix ships as a new version.
Read `CLAUDE.md` first; every rule there applies (explicit `git add` paths, core purity,
two version numbers, `check:ext` before commit, nothing from a real account in the repo).
## Step 1 · Write down the symptom (no tools yet)
Collect what the owner or a user actually saw. Ask the owner for anything missing:
- the exact error line from the run log or `_download_result.json`
- the Doctor panel rows (D1–D7) with their detail text, which the owner can copy from the panel
- the extension version and the date it started
Map it to a suspect with this table. It is a starting point, not a verdict.
| Symptom | First suspect | Code |
|---|---|---|
| Doctor D1 red / "suno.com tab lost" | content script not injected, suno.com URL change | `extension/cs-bridge.js`, manifest `content_scripts.matches` |
| D2 "no token" while signed in | the page no longer sends `Authorization: Bearer` to a watched host | `extension/cs-main.js` `API_HOSTS`, `SITE_API_PATH`; `lib/session.mjs` `watchForToken` |
| D3 / "billing unreadable: unexpected shape" | `/api/billing/info/` | `core/billing.mjs` `billingShape`, `decideWavRoute`, `quotaGuard` |
| D4 / empty or broken workspace list | `/api/project/me` | `app/ui.mjs` itemsOf `projects`, `core/paging.mjs` |
| "listing the workspace failed", wrong take count | `/api/project/{id}?page=` | `app/engine.mjs` itemsOf `project_clips[].clip`, `core/paging.mjs` |
| `studio download HTTP …`, "did not finish in time" (Studio) | `/api/studio/clip/{id}/download?format=wav` | `core/poll.mjs` `interpretStudioPoll`, `app/wav-source.mjs` |
| `convert_wav HTTP …`, `wav_file HTTP …` (legacy) | `/api/gen/{id}/convert_wav/`, `/wav_file/` | `core/poll.mjs` `interpretLegacyPoll`, `app/wav-source.mjs` |
| D6/D7 red, transfer blocked, CORS | WAV bytes moved to another host | manifest `host_permissions`, `scripts/build-extension.mjs` `EXPECTED_HOST_PERMISSIONS` |
| "size … vs expected", "a different take" | WAV format or embedded id changed | `core/wav.mjs` `verifyWav` |
| Many 429s, runs crawl | Suno tightened rate limits | `app/wav-source.mjs` `KICK_GAP_MS`, `core/constants.mjs` pools, `core/poll.mjs` backoff |
| Filters, details or `.txt` notes missing a field | a soft metadata field renamed | `app/filters.mjs` `clipFacts`, `app/song-notes.mjs` |
## Step 2 · Rule out our own code (offline, free)
```
<!-- ‹guest · 2026-12-04› -->
npm test && npm run check:ext && npm run test:e2e
```
If any of these fail on an unchanged `main`, the bug is ours, not Suno's: fix that first.
They all run against **fixtures**, so they cannot see API drift. Green here plus a live failure
points at Suno.
## Step 3 · Probe the live API (read-only, costs nothing)
```
node scripts/api-probe.mjs # billing, workspace list, newest workspace's clips, token hosts
node scripts/api-probe.mjs --workspace <id> # the workspace the failing run used
```
- It opens the shared signed-in Chrome profile (`lib/session.mjs`), so it runs here without the
owner, unless it exits **2**. Exit 2 means not signed in. Give the owner exactly
`! node skills/suno-download/scripts/download.mjs --login` and wait.
- `--wav <clipId>` also asks the Studio WAV endpoint about one clip. That request starts a render,
so **ask the owner first** and use a clip id they name.
- How to read the output:
- `✗ hard`: a field a run needs is missing or retyped. This is the break.
- `△ soft`: a display, filter or note detail is missing. That can be normal; for example,
sliders exist only on takes made with sliders.
- `+ new` / `− gone vs fixture` usually shows where a renamed field went.
- `token capture` lists the hosts the page sent its bearer token to. If none is watched by
`cs-main.js`, the extension will say "no token".
- The raw responses are in the printed folder **outside the repo**. Read them to see the new shape.
Never copy them into the repo: they are the owner's songs and plan.
The probe cannot see three things; check them by hand:
- the WAV byte host: look at the `download_url` / `wav_file_url` host in a raw Studio response
from `--wav`
- the headers Suno's own front end sends (C18 in `cs-bridge.js`)
- anything about the suno.com page layout. The extension does not depend on the DOM; suno-submit
does, and has its own `--doctor`.
## Step 4 · Repair: failing test first, smallest change
1. **Update the fixture to the new shape**, with invented data only:
- Take the shape from the raw response, but keep the fixture's fake ids, titles and lyrics.
- Edit `test/fixtures/suno-api/*.json`, adding or renaming only the fields that moved.
- Never paste real values: ids, titles, lyrics, emails, prices.
<!-- ‹guest · 2026-12-04› -->
2. **Write the failing test.** Find the test file for the reader the probe named (`who` column):
- `test/download-core.test.mjs` covers billing, paging, poll interpretation, naming and
`verifyWav`
- `test/engine.test.mjs` covers the run
- `test/wav-source.test.mjs` covers WAV requests and polling
- `test/filters.test.mjs` and `test/song-notes.test.mjs` cover soft fields
- `test/doctor.test.mjs` covers D1–D7
- the E2E mock `test/e2e/mock-suno.mjs` serves the same fixtures
Watch it go red.
3. **Fix the reader.** Prefer accepting both the old and the new shape for one release when that
is cheap. Never guess a missing value: `billing.mjs` explains why an unreadable shape must stop
the run. Update `CONTRACT` in `scripts/api-probe.mjs` if a field's path changed, so the next
probe checks the new one.
4. **Know the blast radius:**
- A change in `extension/src/core/` is shared with `skills/suno-download/scripts/download.mjs`.
Check that caller, keep its console output word for word, and bump
`.claude-plugin/plugin.json`.
- A new or changed host permission is a **permission change**:
- edit the manifest, `EXPECTED_*` in `scripts/build-extension.mjs`, the manifest test, and
`extension/store/permissions.md`
- tell the owner the review will look at it, and that Chrome may ask existing users to
re-approve
5. Re-run Step 2 (all green) and Step 3 (exit 0).
## Step 5 · Regression and release
1. Walk `docs/regression-checklist.md`: every automated row green. Add a row for what you just
fixed, naming the test that now pins it.
2. Bump `extension/manifest.json` (patch version for a repair); also bump the plugin version if
`core/`, `lib/` or `skills/` changed.
3. Commit with explicit paths (never `git add -A`). Say in the body which endpoint drifted, the
probe's before/after verdict, and the tests that pin it. Push only when the owner says to.
4. `npm run release:ext`. It refuses a dirty tree. Give the owner the zip path and its SHA-256.
5. The owner uploads it at the Chrome Web Store developer dashboard (Package → upload new
package → submit). Claude cannot script Web Store pages. If permissions changed, the owner
also pastes the new section of `permissions.md`.
6. After the owner reports it accepted: `git tag ext-v<version>`. Ask before pushing tags.
7. Ask the owner to run the L- rows of `docs/regression-checklist.md` that the fix touched, plus one
real small export.
<!-- ‹guest · 2026-12-04› -->
## What not to do
- Don't drive Suno's UI by hand to "see what changed". The probe and the raw responses are the
evidence (CLAUDE.md: keep the model out of the loop).
- Don't loosen a check to make a red go away: no skipping `billingShape`, no treating an HTTP error
as "wait", no defaulting a missing counter to 0.
- Don't spend the owner's credits or downloads to diagnose. `--wav` and a real export are theirs
to approve.
- Don't commit raw probe output, a Chrome profile, or a real output folder.
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.