{"record":{"id":"d5999f98ed20c792","repo":"calesthio/OpenMontage","slug":"no-taskid-in-suno-response-data","errorCode":null,"errorMessage":"No taskId in Suno response: {data}","messagePattern":"No taskId in Suno response: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"tools/audio/suno_music.py","lineNumber":238,"sourceCode":"            payload[\"title\"] = inputs.get(\"title\", \"\")\n        else:\n            payload[\"prompt\"] = inputs[\"prompt\"][:500]  # description, max 500 chars\n\n        response = requests.post(\n            f\"{self._BASE_URL}/generate\",\n            headers={\n                \"Authorization\": f\"Bearer {api_key}\",\n                \"Content-Type\": \"application/json\",\n            },\n            json=payload,\n            timeout=30,\n        )\n        response.raise_for_status()\n        data = response.json()\n\n        task_id = data.get(\"data\", {}).get(\"taskId\") or data.get(\"taskId\")\n        if not task_id:\n            raise RuntimeError(f\"No taskId in Suno response: {data}\")\n\n        return task_id\n\n    def _poll(self, task_id: str, api_key: str) -> dict:\n        \"\"\"Poll for task completion and return the result data.\"\"\"\n        import requests\n\n        elapsed = 0\n        while elapsed < self._MAX_WAIT:\n            time.sleep(self._POLL_INTERVAL)\n            elapsed += self._POLL_INTERVAL\n\n            response = requests.get(\n                f\"{self._BASE_URL}/generate/record-info\",\n                params={\"taskId\": task_id},\n                headers={\"Authorization\": f\"Bearer {api_key}\"},\n                timeout=30,\n            )","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/audio/suno_music.py#L220-L256","documentation":"Raised by SunoTool after a successful HTTP POST to the Suno API when neither data.data.taskId nor data.taskId is present in the JSON response. The generation task was never created, so there is nothing to poll. It usually means the third-party Suno gateway returned an error payload or auth/quota message with HTTP 200, or the gateway's response schema differs from what this client expects.","triggerScenarios":"POSTing a generate-music payload to a Suno-compatible gateway (api-key via Bearer token) where the response body contains an error object, a different key name for the task id, or an HTML/login page instead of JSON with a taskId.","commonSituations":"Invalid or expired Suno API key; gateway quota exhausted; using a Suno proxy whose response schema (e.g. data.data.taskId vs taskId vs clipId) differs by version; base URL pointing to the wrong endpoint.","solutions":["Inspect the full response body included in the message — it states exactly what the gateway returned (auth error, quota, different schema).","Verify the Suno API key is valid and the account has generation credits.","Compare the returned JSON's task-id field name against data.data.taskId / taskId and add the correct key to the extraction in _create.","Confirm the gateway base URL matches the provider documented for this tool version."],"exampleFix":"// before\ntask_id = data.get(\"data\", {}).get(\"taskId\") or data.get(\"taskId\")\n\n// after (tolerate alternate schemas)\ntask_id = (\n    data.get(\"data\", {}).get(\"taskId\")\n    or data.get(\"taskId\")\n    or data.get(\"data\", {}).get(\"task_id\")\n    or data.get(\"task_id\")\n)\nif not task_id:\n    raise RuntimeError(f\"No taskId in Suno response: {data}\")","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    task_id = tool._create(payload, api_key)\nexcept RuntimeError as e:\n    if \"No taskId\" in str(e):\n        # response body is embedded in the message; log it and check key/quota\n        raise","preventionTips":["Validate the Suno API key with a cheap endpoint before submitting generation jobs","Log full gateway responses during integration to catch schema drift early"],"tags":["api","suno","music","schema-mismatch","authentication"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}