Error codes
Every error Cochl.Sense Pro and the cochl Python library can return — request rejections, failed services inside job results, speaker recognition errors, and rate limits.
This page lists the errors you can run into when calling Cochl.Sense Pro — both errors returned immediately when a request is rejected, and errors that show up later inside a completed analysis job. If you're using the official Python library (cochl), see §6 for how these appear as exceptions. Every call made with your project keys, the rejected ones included, is listed with its error in the Dashboard’s Request log.
1. Two places errors come from
The most important thing to understand about this API's errors is when they happen:
| Error kind | When | How it's delivered |
|---|---|---|
| ① Request errors (synchronous) | The moment you send the request | Auth, option, or file problems. For project-key requests (§3), always a non-200 HTTP status code. For speaker recognition (§5), only auth failures use a status code (401) — business-rule violations return HTTP 200 with the error in the response body instead. |
| ② Analysis errors (asynchronous) | After the request is accepted, during background processing | analyze / analyze_file accept the request and immediately return a job_id; analysis then runs in the background. Problems in the analysis engines don't come back as HTTP errors — they show up inside the job result, per service. (§4) |
Response body shapes
The shape of the error body depends on which kind of error it is — worth knowing before you write a parser:
| Error type | HTTP | Body shape |
|---|---|---|
| General error | 400 / 401 / 402 / 404 / 422 | {"error": "<message>"} |
| Request validation failure | 422 | {"error": "Validation error", "details": [ ... ]} |
Result file not ready (GET /api/v1/jobs/{job_id}/result_url) | 409 | {"error": {"error": "Result not available", "status": "<job status>"}} — error is an object here, not a string. |
| Internal server error (unhandled) | 500 | Internal Server Error — plain text, not JSON. Parsing it as {"error": ...} will fail. The one 500 that is JSON is API key verification failed. |
Speaker recognition API (/api/v2) | 200 / 401 / 502 | {"data": null, "error": "<message>", "debug": "<...>"} |
2. Authentication keys
| Key | Header | Used for |
|---|---|---|
| Project key | X-Api-Key | Audio analysis (IntegratedApi) — sound event detection / speech analysis / audio insights |
| Organization key | X-Org-Key | Speaker registration & recognition (SpeakerProfileApi) |
A project key doesn't expire on its own — issuing a new one invalidates the old one, and a request made with an invalidated key gets Invalid API key. Resetting a key on the Dashboard revokes the old one immediately, and the new key works right away.
3. Request errors (synchronous — project key)
These are HTTP errors returned by POST /api/v1/analyze and POST /api/v1/analyze_file at the moment the request is accepted or rejected.
| Situation | HTTP | Response body | What to do |
|---|---|---|---|
| Key missing (header absent/empty) | 401 | {"error":"API key required"} | Send your project key in the X-Api-Key header (§2). Copy it from the Dashboard — Get your project key. |
| Key invalid (typo, revoked, deleted) | 401 | {"error":"Invalid API key"} | Copy the current key from the project’s Settings (Get your project key). A newly issued key is accepted right away (§2). If it still fails, reset the key or create a new project (FAQs). |
| No analysis service enabled | 400 | {"error":"No services selected: turn on sound_event_detection, speech_analysis or audio_insights."} | Enable at least one service — see Valid service combinations. |
audio_insights enabled without both sound_event_detection and speech_analysis | — | Not returned since December 1, 2026 (before that: 400 with audio_insights requires both speech_analysis and sound_event_detection to be true) | Audio insights can now run on its own — see Valid service combinations. |
options form field isn’t a JSON object (/analyze_file) | 422 | {"error":"options must be a valid JSON object"} | Send options as a JSON-encoded object string, e.g. {"sound_event_detection": true, ...}. |
translation enabled without speech_analysis | 400 | {"error":"translation requires speech_analysis: true"} | — |
sound_event_tags sent without sound_event_detection | 400 | {"error":"sound_event_tags requires sound_event_detection: true"} | Turn on sound_event_detection, or leave sound_event_tags out. |
sound_event_tags lists a name the model doesn’t know | 400 | {"error":"Unknown sound_event_tags: Glass_brake (did you mean Glass_break?). ..."} | Use the exact, case-sensitive names from Sound tags. An empty list or more than 200 names is a 422. |
sound_event_thresholds sent without sound_event_detection | 400 | {"error":"sound_event_thresholds requires sound_event_detection: true"} | Turn on sound_event_detection, or leave sound_event_thresholds out. |
sound_event_thresholds names a tag the model doesn’t know | 400 | {"error":"Unknown sound_event_thresholds: Screem (did you mean Scream?). ..."} | Use the names from GET /api/v1/tags. Values outside 0–1 or an empty object are a 422. |
| Custom thresholds can’t be applied right now | 503 | {"error":"Custom sound_event_thresholds are unavailable right now. Try again later."} | Retry later, or send the request without sound_event_thresholds. |
| Undefined option key sent (e.g. a retired field name) | 422 | {"error":"Validation error","details":[{"type":"extra_forbidden","loc":["body","options","<field>"], ...}]} | — |
Required field missing (e.g. samplerate) | 422 | {"error":"Validation error","details":[{"type":"missing","loc":["body","<field>"], ...}]} | — |
Unsupported or corrupted audio file (decode failure, /analyze_file) | 400 | {"error":"empty file"}, {"error":"cannot decode .<ext> audio"}, {"error":"cannot decode audio (unsupported or corrupted file)"}, {"error":"no audio samples found in file"}, or {"error":"audio conversion timed out"} | WAV, FLAC, and OGG are read directly; other formats go through FFmpeg, which is given 120 seconds per file — a very long or very large file in another format can hit that limit and get audio conversion timed out. If the file still can’t be decoded or converted, convert it to MP3, WAV, FLAC, or OGG — Convert to supported file formats. |
| Audio longer than 59 minutes | 400 | {"error":"Audio is too long: 61:12 (max 59:00). Split the file and try again."} (with your file’s length) | Split the file into parts of 59 minutes or less and send each as its own request. |
Invalid base64 audio data (/analyze only) | 400 | {"error":"audio_data is not valid base64"}, {"error":"audio_data is empty"}, or {"error":"audio_data must be float32 PCM (length must be a multiple of 4 bytes)"} | Send raw float32 PCM samples, base64-encoded. |
| Trial allowance exceeded: the minutes already used plus this file’s length would go over the 20 free minutes | 402 | {"error":"exceeded maximum usage limit"} | Open Billing on the Dashboard and click Add card to keep going, pay as you go, or contact support@cochl.ai — FAQs. A shorter file may still fit in the remaining minutes. |
| Path doesn't exist | 404 | {"error":"Not Found"} | — |
| Internal error during key verification | 500 | {"error":"API key verification failed"} | — |
Authentication is always checked first. If your key is missing or invalid, you'll get a 401 even if the request body also has other problems — you won't see a 400 or 422 until the key is valid.
On success, both endpoints return 200 with {"job_id": "...", "status": "accepted", "created_at": "..."}. Analysis then continues in the background — see §4.
Errors when fetching a job
These come from the job endpoints (GET /api/v1/jobs, GET /api/v1/jobs/{job_id}, and GET /api/v1/jobs/{job_id}/result_url), after the same key check as above.
| Situation | HTTP | Response body | What to do |
|---|---|---|---|
Unknown job_id, or a job that belongs to another project | 404 | {"error":"Job not found"} | Use the job_id returned by analyze / analyze_file, with the same project key. |
from_date / to_date on GET /api/v1/jobs isn’t an ISO 8601 date | 400 | {"error":"Invalid from_date (expected ISO 8601 format)"} (or to_date) | Pass dates such as 2026-06-01 or 2026-06-01T09:00:00+00:00. |
| Result file requested before the job has one (still running, or failed) | 409 | {"error":{"error":"Result not available","status":"processing"}} | Wait until the job’s status is completed. Note that error is an object here. |
Jobs are kept for fast lookup for 24 hours. After that, GET /api/v1/jobs/{job_id} still returns the job’s status and details but no longer includes result; fetch the result file through GET /api/v1/jobs/{job_id}/result_url instead.
4. Service errors inside job results (asynchronous)
Because analyze / analyze_file return 200 accepted as soon as the request is queued, problems during analysis aren't HTTP errors — they appear inside the job result once you fetch it. GET /api/v1/jobs/{job_id} returns HTTP 200 even when a service failed; only that service's entry is marked status: "error" (other services that succeeded still return their results — partial success is normal).
GET /api/v1/jobs/{job_id} -> HTTP 200
{
"job_id": "b8cbefce-...",
"status": "completed",
"created_at": "...",
"completed_at": "...",
"metadata": { "audio": { ... }, "warnings": [] },
"result": {
"sound_event_detection": { "status": "error", "error": "This service could not process the audio. Retry, or contact support with the job ID." },
"speech_analysis": { "status": "success", "results": [ ... ] },
"audio_insights": { "status": "success", "result": { ... } },
"metadata": { "audio": { ... }, "warnings": [] }
}
}The service’s error string is the same for every cause — This service could not process the audio. Retry, or contact support with the job ID. — so the engine’s internal details don’t reach your app. The one exception is sound event detection with custom thresholds when the model can’t be checked: Custom sound_event_thresholds could not be applied. Try again later. Find the likely cause here:
| Cause | Where it shows up | error string |
|---|---|---|
| The audio is shorter than one sound event detection window (2 seconds), so there is nothing to analyze | sound_event_detection | The common message above — send audio that is at least 2 seconds long. |
| The analysis engine rejected the job (responded with 3xx or higher) | sound_event_detection and speech_analysis (every one you enabled) | The common message above — retry; if it keeps failing, contact support with the job ID. |
| The analysis engine couldn’t be reached (timeout after 30 s, network error) | sound_event_detection and speech_analysis (every one you enabled) | The common message above — retry. |
| The audio insights summary couldn’t be generated | audio_insights | The common message above, in {"status": "error", "error": "..."} |
A whole job can also fail before any service runs (for example, if the uploaded audio can’t be stored). Then the job’s own status is "failed", there is no result, and the reason is in a top-level error field:
GET /api/v1/jobs/{job_id} -> HTTP 200
{
"job_id": "b8cbefce-...",
"status": "failed",
"created_at": "...",
"metadata": { ... },
"error": "Analysis failed. Retry, or contact support with the job ID."
}On the progress stream this arrives as an error event, and get_completed_result() returns None (§6.1).
Always check the job’s status and each service’s status field — a completed job is not the same as a fully successful one. Also check metadata.warnings: some option problems don’t fail the request but are reported there instead (for example, a speech_lang that wasn’t applied — see speech analysis).
5. Speaker recognition errors (organization key — /api/v2)
The speaker recognition API (used by SpeakerProfileApi) always wraps its response in a {data, error, debug} envelope. Authentication failures return 401 and an unreachable speaker engine returns 502; everything else — business-rule violations — returns HTTP 200 with an error field (kept for compatibility with the legacy SR server).
| Situation | HTTP | Response body | What to do |
|---|---|---|---|
| Organization key missing (header absent) | 401 | {"data":null,"error":"x_org_key required","debug":""} | Send your organization key in the X-Org-Key header. Find your organization key (Account key) at the bottom of the Speaker Profiles page on the Dashboard (under Account in the sidebar) (speaker profile §2.2). |
| Organization key invalid (not registered) | 401 | {"data":null,"error":"organization not found","debug":""} | Find your organization key (Account key) at the bottom of the Speaker Profiles page on the Dashboard (under Account in the sidebar) (speaker profile §2.2). |
| Speaker name violates naming rules (letters, digits, and underscores only), or is empty | 200 | {"data":null,"error":"speaker is invalid. only alphabet, number and underscore are allowed","debug":""} | Use letters, digits, and underscores only — Anna_Kim, not Anna Kim. Despite the message, letters and digits from any script are accepted (Limitations). |
| Voice file missing on registration | 200 | {"data":null,"error":"file is required","debug":""} | — |
| Empty file uploaded | 200 | {"data":null,"error":"an empty file","debug":""} | — |
Voice file exceeds 10 MB (blocked client-side by SpeakerProfileApi before the request is sent) | — | CochlSenseException: one of files is bigger than 10.0 MB (add_new_voice) / file is bigger than ... MB (recognize) | Keep each voice file under 10 MB (Limitations). |
| Registering a new speaker when the organization already has 50 | 200 | {"data":null,"error":"max speakers (50) exceeded for organization","debug":""} | An organization can register up to 50 speakers (Limitations); profiles are deleted with remove() (§2.2). |
| Adding a voice to a speaker that already has 20 | 200 | {"data":null,"error":"max voices (20) exceeded for speaker '<name>'","debug":""} | Each speaker can hold up to 20 voice samples (Limitations). |
| The voice file couldn’t be processed (for example, it can’t be decoded) | 200 | {"data":null,"error":"enroll failed","debug":""} | Re-encode the file (WAV is the safest choice) and try again. |
| Speaker engine unreachable | 502 | {"data":null,"error":"speaker service unavailable","debug":""} | — |
The server itself doesn’t check the size or duration of a voice file. The 10 MB cap is applied by the Python library before it sends the file, and a take recorded in the Dashboard’s Add speaker dialog is at most 30 seconds. Each speaker supports up to 20 voice samples (5–20 recommended for accuracy), and an organization can register up to 50 speakers in total.
6. Errors in the Python library
Most users call this API through the official Python library rather than raw HTTP. The exceptions it actually raises can differ from the raw API response above, so they're listed separately. This section describes cochl 2.0.2 and later (the current version is 2.0.3).
CochlSenseException inherits from BaseException, not Exception — a bare except Exception: will not catch it. You must catch CochlSenseException explicitly.
6.1 IntegratedApi (audio analysis — project key)
When a request fails (any non-2xx response), the library discards the server's detailed message and uses only the HTTP reason phrase as the exception message. For example, the server's Invalid API key becomes just Unauthorized. Every such exception is a CochlSenseException. Its message attribute holds only the reason phrase; converting the exception to a string (str(e), or printing it) appends a second line, Please contact support@cochl.ai — so str(e) is "Unauthorized\nPlease contact support@cochl.ai" while e.message is "Unauthorized".
| Situation | API response | Library exception | What to do |
|---|---|---|---|
| Invalid project key | 401 Invalid API key | CochlSenseException: Unauthorized | See Invalid API key. |
| Unsupported format or corrupted file | 400 (detailed message) | CochlSenseException: Bad Request | See decode failure. |
| No service selected, or an invalid option combination | 400 (detailed message) | CochlSenseException: Bad Request | See Valid service combinations. |
| Trial allowance exceeded | 402 exceeded maximum usage limit | CochlSenseException: Payment Required | See usage limit exceeded. |
| Too many jobs at once (1 on the trial, 10 on paid plans), or too many open result streams | 429 | CochlSenseException: Too Many Requests from analyze_file; the result stream raises urllib’s HTTPError | Wait for a running job to finish, then retry. See Limits. |
| Server-side error | 500 | CochlSenseException: Internal Server Error | Retry later; if it persists, contact support@cochl.ai. |
| Object created with an empty project key | (before the request is sent) | ValueError: invalid project key "" | Pass your project key to IntegratedApi(...) — Get your project key. |
| An individual analysis service failed | 200 (inside the result — see §4) | No exception raised — check result["<service>"]["status"] == "error" yourself | See §4. |
get_completed_result(job_id) returns None, without raising an exception, if the job failed (§4) or if it hasn’t finished within 10 minutes (when the server closes the progress stream). In the second case the job keeps running: call get_completed_result(job_id) again, or fetch GET /api/v1/jobs/{job_id}, within 24 hours. Always check the return value before using it.
6.2 SpeakerProfileApi (speaker registration & recognition — organization key)
Because speaker recognition's business-rule violations come back as 200 + error, the library passes the server's actual message straight through. Authentication failures (401) are the one exception — those still collapse to the reason phrase, as with IntegratedApi.
| Situation | Library exception / result | What to do |
|---|---|---|
| Invalid organization key | CochlSenseException: Unauthorized | See organization not found. |
| Speaker name violates naming rules | CochlSenseException: speaker is invalid. only alphabet, number and underscore are allowed | See speaker is invalid. |
| Uploaded file exceeds 10 MB (blocked client-side before the request) | CochlSenseException: one of files is bigger than 10.0 MB / file is bigger than ... MB | Keep each voice file under 10 MB (Limitations). |
| Object created with an empty organization key | ValueError: invalid project key "" | Find your organization key (Account key) at the bottom of the Speaker Profiles page on the Dashboard (under Account in the sidebar) (speaker profile §2.2). |
6.3 Recommended error-handling pattern
from cochl.sense import IntegratedApi, IntegratedApiOptions
from cochl.sense.exception import CochlSenseException
from cochl.sense.http_request import HttpRequestException
import urllib.error
api = IntegratedApi("YOUR_PROJECT_KEY")
try:
job = api.analyze_file(
"audio.wav",
IntegratedApiOptions(
sound_event_detection=True,
speech_analysis=False, # the service flags default to True
audio_insights=False,
),
)
result = api.get_completed_result(job["job_id"])
if result is None:
# Job failed, or not finished within 10 minutes — not an exception
print("analysis did not complete")
else:
sed = result.get("sound_event_detection", {})
if sed.get("status") != "success":
print("SED failed:", sed.get("error"))
except CochlSenseException as e: # inherits BaseException — must be explicit
print("API error:", e.message) # e.g. Unauthorized / Bad Request / Payment Required
except HttpRequestException as e: # analyze_file: empty file / connection failure
print("request error:", e.message)
except FileNotFoundError as e: # missing file
print("file not found:", e)
except urllib.error.HTTPError as e: # get_completed_result: 401 invalid key, 404 unknown job_id
print("stream error:", e.code)
except urllib.error.URLError as e: # get_completed_result: connection failure
print("connection error:", e.reason)get_completed_result() reads the progress stream with Python’s urllib, so its errors are urllib exceptions rather than HttpRequestException. Keep HTTPError before URLError: HTTPError is a subclass of URLError.
Even if you keep a catch-all except Exception: as a safety net, put except CochlSenseException: before it — otherwise API errors go uncaught and the program exits.
cochlearai/cochl-sense-py
More runnable sample scripts.
6.4 Legacy Client (EventDetectionApi, cochl 2.0.1 and earlier)
Client is the legacy v1.x sound event detection-only client (api.cochl.ai/sense, not the Integration API). It was removed in cochl 2.0.2, so the errors below apply only to code still pinned to 2.0.1 or earlier. Use IntegratedApi (§6.1) instead.
| Situation | Exception | Message |
|---|---|---|
| Empty/missing project key | ValueError | invalid project key "" |
| File doesn't exist | FileNotFoundError | the file path |
| Unsupported format (not mp3/wav/ogg) | ValueError | invalid file format "...", supported formats: ['mp3', 'wav', 'ogg'] |
| API request failed | CochlSenseException | HTTP reason phrase, or the server's error message |
| Server-side analysis error | CochlSenseException | the server's error message |
predict(timeout=N) exceeded | TimeoutException (also BaseException, not Exception) | Prediction (session_id=...) has timed out "Ns" |
7. Rate limits & audio length
There is no request-rate limit, but the number of jobs running at once is capped, and so is the request size:
| Situation | HTTP | Response body | What to do |
|---|---|---|---|
| The organization already has its maximum of jobs in progress (1 on the trial, 10 on paid plans) | 429 | {"error":"Too many jobs in progress for this organization (limit N). Wait for a running job to finish, then retry."} | Wait for a job to finish, then retry. Queue your files and send the next one when a job completes. |
| The project already has 20 progress streams open | 429 | {"error":"Too many open result streams for this project (limit 20). Close a stream or poll GET /api/v1/jobs/{job_id} instead."} | Close streams you no longer read, or poll GET /api/v1/jobs/{job_id} (REST API). |
| Request body over 1 GiB | 413 | {"error":"Request body too large (max 1 GiB)."} | Compress or split the audio. |
Long files are affected by these limits:
| Limit | Applies to | What happens |
|---|---|---|
| 59 minutes maximum | Every request: the API, the Python library and the Dashboard | A longer file is rejected right away with 400 (audio too long). Split it and send the parts. |
| 2 seconds minimum | Sound event detection | Audio shorter than one 2-second window fails sound event detection with a service error (§4). |
| 120 seconds for format conversion | Files in formats other than WAV, FLAC, or OGG, converted with FFmpeg when you upload | The request is rejected right away with 400 audio conversion timed out (decode failure). |
| 10 minutes per progress stream | The progress stream that get_completed_result() and create_event_stream_request() read | The stream ends with an error event (Stream timeout) and get_completed_result() returns None — but the job keeps running. Call get_completed_result() again or fetch GET /api/v1/jobs/{job_id}. |
| 24 hours | Job results kept for fast lookup | After that, GET /api/v1/jobs/{job_id} no longer includes result; use GET /api/v1/jobs/{job_id}/result_url (Errors when fetching a job). |
For very long recordings, splitting them client-side keeps each job well inside the 10-minute stream window; send the parts one after another, or up to your plan’s limit of jobs in progress at once.
See also
- Custom sound: Speaker profile—registering and recognizing speakers; see §5 above for its error cases
- Getting started—setup and your first request
- Sound event detection—detection details and service options referenced in §3
Last updated
Need help? Contact support@cochl.ai
For Cochl.Sense Pro, include the job_id and the time of the request (with time zone).

