vxcontrol/pentagi · warning

[${error.statusCode}] ${error.statusText || 'empty statusTex

Error message

[${error.statusCode}] ${error.statusText || 'empty statusText'}

What it means

In frontend/src/lib/axios.ts the response interceptor logs any failed HTTP response whose status code is truthy: `Log.warn(`[${statusCode}] ${statusText || 'empty statusText'}`)`. It is a diagnostic warning, not a thrown error — the literal 'empty statusText' appears when the response has a status code but no reason phrase (common with JSON APIs and proxies).

Source

Thrown at frontend/src/lib/axios.ts:77

    },
    timeout: 30_000,
    withCredentials: true,
});

axios.interceptors.response.use(
    (res) => res.data,
    (err: AxiosError): Promise<never> => {
        const error: ApiHttpError = {
            message: err.message,
            name: err.name,
            response: err.response,
            stack: err.stack,
            statusCode: err.response?.status,
            statusText: err.response?.statusText,
        };

        if (error.statusCode) {
            Log.warn(`[${error.statusCode}] ${error.statusText || 'empty statusText'}`);

            switch (error.statusCode) {
                case 0: {
                    Log.error('No host was found to connect to.');
                    break;
                }

                case 200: {
                    Log.error(
                        'Failed to parse the return value, please check if the response is returned in JSON format',
                    );
                    break;
                }

                case 400: {
                    if (err.response?.data) {
                        Log.warn(err.response.data);
                        const warns = err.response.data as Record<string, string[]>;

View on GitHub (pinned to ea665308ba)

Solutions

  1. Check the numeric statusCode logged alongside the warning and branch on the interceptor's switch cases (0, 401, 403, etc.) to identify the real problem.
  2. If the message is confusing, inspect the response body in the network tab — the backend usually returns a JSON error code (e.g. 'AuthRequired') that drives the interceptor's dedicated handling.
  3. Improve the log line by appending the request URL/method so the offending call is identifiable.
  4. For noisy recurring warnings (e.g. periodic polls returning 401), fix the root cause on the backend or stop the polling after session expiry.

Example fix

// before
Log.warn(`[${error.statusCode}] ${error.statusText || 'empty statusText'}`);
// after
Log.warn(`[${error.statusCode}] ${error.statusText || 'empty statusText'} ${config.method?.toUpperCase()} ${config.url}`);
Defensive patterns

Strategy: try-catch

Validate before calling

const res = await fetch(url, { method: 'HEAD' }).catch(() => null);
if (!res || res.status >= 400) console.warn('API endpoint unhealthy before call');

Type guard

function isHttpError(e: unknown): e is AxiosError {
  return axios.isAxiosError(e) && e.response != null;
}

Try / catch

try {
  await api.get('/flow');
} catch (err) {
  const status = axios.isAxiosError(err) ? err.response?.status : undefined;
  if (status && status !== 401 && status !== 403) {
    Log.warn(`Request failed with status ${status}`);
  }
}

Prevention

When it happens

Trigger: Any API request that resolves with an error HTTP response (4xx/5xx) where err.response.status is non-zero; especially responses whose statusText is blank (HTTP/2 responses, custom backends) which render the 'empty statusText' placeholder.

Common situations: See trigger scenarios.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01). Data as JSON: /api/errors/1c0562c71683e899. Report an issue: GitHub.