SillyTavern/SillyTavern · error

Internal server error

Error message

Internal server error

What it means

This is the top-level catch-all of the MiniMax TTS POST route in src/endpoints/minimax.js:226. Any exception thrown anywhere in the surrounding try block — during request construction, the MiniMax API fetch, response parsing, or audio extraction — falls through to this handler and is returned to the client as a generic HTTP 500 'Internal server error'. The real cause is logged to console.error but hidden from the response, so the client cannot distinguish a network failure from an auth failure or a malformed response.

Solutions

  1. Inspect the server console output — the full error object is logged by console.error('MiniMax TTS generation failed:', error).
  2. Verify the MiniMax API key and group_id are correctly set in the connection/secrets settings.
  3. Confirm network connectivity to the MiniMax API host from the server.
  4. Validate the request payload (model, voice, text) is complete and well-formed before the call.
  5. Add more granular inner try/catch blocks that return a specific error message instead of relying on the generic 500.

Example fix

// before
    } catch (error) {
        console.error('MiniMax TTS generation failed:', error);
        return response.status(500).json({ error: 'Internal server error' });
    }

// after
    } catch (error) {
        console.error('MiniMax TTS generation failed:', error);
        return response.status(500).json({
            error: 'Internal server error',
            detail: error?.message ?? String(error),
        });
    }
Defensive patterns

Strategy: try-catch

Validate before calling

// Before calling MiniMax, validate required generation fields
function validateMiniMaxRequest(body) {
    const missing = ['model', 'text', 'voice'].filter(k => !body?.[k]);
    if (missing.length) {
        return { ok: false, error: `Missing fields: ${missing.join(', ')}` };
    }
    return { ok: true };
}

Type guard

function isMiniMaxError(error) {
    return error?.name === 'FetchError'
        || error?.message?.includes('invalid json')
        || error?.code === 'ECONNREFUSED';
}

Try / catch

// Distinguish failure classes instead of one generic 500
try {
    // ... MiniMax call ...
} catch (error) {
    if (error?.name === 'AbortError') {
        return response.status(504).json({ error: 'MiniMax request timed out' });
    }
    if (error?.code === 'ECONNREFUSED' || error?.code === 'ENOTFOUND') {
        return response.status(502).json({ error: 'Cannot reach MiniMax API' });
    }
    console.error('MiniMax TTS generation failed:', error);
    return response.status(500).json({ error: 'Internal server error', detail: error?.message });
}

Prevention

When it happens

Trigger: The MiniMax API call throws (DNS/TCP failure, timeout, invalid JSON response), the response shape does not match expectations and a property access throws, or an error occurs in a code path not covered by the inner urlError catch (e.g. building the request body throws on undefined fields). Authentication errors (invalid group_id/api_key) that surface as thrown exceptions rather than handled status codes also land here.

Common situations: Expired or invalid MiniMax API key or group_id; network/firewall blocking api.minimaxi.com; MiniMax API schema change shifting the response shape; large text payloads hitting upstream timeouts; the audio-from-URL fetch failing in a way that escapes the inner catch.

Understand the failure class

Related errors


AI-assisted analysis of SillyTavern/SillyTavern@06bde939fb (2026-08-13). Data as JSON: /api/errors/4f8d551131ee7826. Report an issue: GitHub.

Appendix: source

Thrown at src/endpoints/minimax.js:225

                const mimeType = getAudioMimeType(format);

                response.setHeader('Content-Type', mimeType);
                response.setHeader('Content-Length', audioBuffer.byteLength);

                return response.send(Buffer.from(audioBuffer));
            } catch (urlError) {
                console.error('MiniMax TTS: Error fetching audio from URL:', urlError);
                return response.status(500).json({ error: `Failed to fetch audio: ${urlError.message}` });
            }
        } else {
            // Handle error response
            const errorMessage = responseData.base_resp?.status_msg || responseData.error?.message || 'Unknown error';
            console.error('MiniMax TTS: No valid audio data in response:', responseData);
            return response.status(500).json({ error: `API Error: ${errorMessage}` });
        }
    } catch (error) {
        console.error('MiniMax TTS generation failed:', error);
        return response.status(500).json({ error: 'Internal server error' });
    }
});

View on GitHub (pinned to 06bde939fb)