{"record":{"id":"6979614be8ff9677","repo":"ruvnet/ruflo","slug":"unsupported-audio-format-contenttype","errorCode":null,"errorMessage":"Unsupported audio format: ${contentType}","messagePattern":"Unsupported audio format: (.+?)","errorType":"http","errorClass":"HttpError","httpStatus":400,"severity":"error","filePath":"ruflo/src/ruvocal/src/routes/api/transcribe/+server.ts","lineNumber":40,"sourceCode":"\tif (!transcriptionModel) {\n\t\tthrow error(503, \"Transcription is not configured\");\n\t}\n\n\tconst token = getApiToken(locals);\n\n\tif (!token) {\n\t\tthrow error(401, \"Authentication required\");\n\t}\n\n\tconst rawContentType = request.headers.get(\"content-type\") || \"\";\n\t// Normalize content-type: Safari sends \"audio/webm; codecs=opus\" (with space)\n\t// but HF API expects \"audio/webm;codecs=opus\" (no space)\n\tconst contentType = rawContentType.replace(/;\\s+/g, \";\");\n\tconst isAllowed = ALLOWED_CONTENT_TYPES.some((type) => contentType.includes(type));\n\n\tif (!isAllowed) {\n\t\tlogger.warn({ contentType }, \"Unsupported audio format for transcription\");\n\t\tthrow error(400, `Unsupported audio format: ${contentType}`);\n\t}\n\n\tconst contentLength = parseInt(request.headers.get(\"content-length\") || \"0\");\n\tif (contentLength > MAX_AUDIO_SIZE) {\n\t\tthrow error(413, \"Audio file too large (max 25MB)\");\n\t}\n\n\ttry {\n\t\tconst audioBuffer = await request.arrayBuffer();\n\n\t\tif (audioBuffer.byteLength > MAX_AUDIO_SIZE) {\n\t\t\tthrow error(413, \"Audio file too large (max 25MB)\");\n\t\t}\n\n\t\tconst baseUrl =\n\t\t\tconfig.get(\"TRANSCRIPTION_BASE_URL\") || \"https://router.huggingface.co/hf-inference/models\";\n\t\tconst apiUrl = `${baseUrl}/${transcriptionModel}`;\n","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/ruflo/src/ruvocal/src/routes/api/transcribe/+server.ts#L22-L58","documentation":"Error thrown by the transcribe POST handler when the request's normalized content-type matches none of ALLOWED_CONTENT_TYPES (e.g. non-audio or unsupported codec); the unsupported contentType is logged before rejection.","triggerScenarios":"Thrown at ruflo/src/ruvocal/src/routes/api/transcribe/+server.ts:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send audio in one of the supported content types (e.g. audio/mpeg, audio/wav, audio/webm); convert unsupported formats before uploading."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}