ruvnet/ruflo · error · HttpError

Unsupported audio format: ${contentType}

Error message

Unsupported audio format: ${contentType}

What it means

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.

Source

Thrown at ruflo/src/ruvocal/src/routes/api/transcribe/+server.ts:40

	if (!transcriptionModel) {
		throw error(503, "Transcription is not configured");
	}

	const token = getApiToken(locals);

	if (!token) {
		throw error(401, "Authentication required");
	}

	const rawContentType = request.headers.get("content-type") || "";
	// Normalize content-type: Safari sends "audio/webm; codecs=opus" (with space)
	// but HF API expects "audio/webm;codecs=opus" (no space)
	const contentType = rawContentType.replace(/;\s+/g, ";");
	const isAllowed = ALLOWED_CONTENT_TYPES.some((type) => contentType.includes(type));

	if (!isAllowed) {
		logger.warn({ contentType }, "Unsupported audio format for transcription");
		throw error(400, `Unsupported audio format: ${contentType}`);
	}

	const contentLength = parseInt(request.headers.get("content-length") || "0");
	if (contentLength > MAX_AUDIO_SIZE) {
		throw error(413, "Audio file too large (max 25MB)");
	}

	try {
		const audioBuffer = await request.arrayBuffer();

		if (audioBuffer.byteLength > MAX_AUDIO_SIZE) {
			throw error(413, "Audio file too large (max 25MB)");
		}

		const baseUrl =
			config.get("TRANSCRIPTION_BASE_URL") || "https://router.huggingface.co/hf-inference/models";
		const apiUrl = `${baseUrl}/${transcriptionModel}`;

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Send audio in one of the supported content types (e.g. audio/mpeg, audio/wav, audio/webm); convert unsupported formats before uploading.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at ruflo/src/ruvocal/src/routes/api/transcribe/+server.ts:40 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/6979614be8ff9677. Report an issue: GitHub.