{"record":{"id":"1c0562c71683e899","repo":"vxcontrol/pentagi","slug":"error-statuscode-error-statustext-empty","errorCode":null,"errorMessage":"[${error.statusCode}] ${error.statusText || 'empty statusText'}","messagePattern":"\\[\\$\\{error\\.statusCode\\}\\] \\$\\{error\\.statusText \\|\\| 'empty statusText'\\}","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"frontend/src/lib/axios.ts","lineNumber":77,"sourceCode":"    },\n    timeout: 30_000,\n    withCredentials: true,\n});\n\naxios.interceptors.response.use(\n    (res) => res.data,\n    (err: AxiosError): Promise<never> => {\n        const error: ApiHttpError = {\n            message: err.message,\n            name: err.name,\n            response: err.response,\n            stack: err.stack,\n            statusCode: err.response?.status,\n            statusText: err.response?.statusText,\n        };\n\n        if (error.statusCode) {\n            Log.warn(`[${error.statusCode}] ${error.statusText || 'empty statusText'}`);\n\n            switch (error.statusCode) {\n                case 0: {\n                    Log.error('No host was found to connect to.');\n                    break;\n                }\n\n                case 200: {\n                    Log.error(\n                        'Failed to parse the return value, please check if the response is returned in JSON format',\n                    );\n                    break;\n                }\n\n                case 400: {\n                    if (err.response?.data) {\n                        Log.warn(err.response.data);\n                        const warns = err.response.data as Record<string, string[]>;","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/frontend/src/lib/axios.ts#L59-L95","documentation":"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).","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","solutions":["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.","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.","Improve the log line by appending the request URL/method so the offending call is identifiable.","For noisy recurring warnings (e.g. periodic polls returning 401), fix the root cause on the backend or stop the polling after session expiry."],"exampleFix":"// before\nLog.warn(`[${error.statusCode}] ${error.statusText || 'empty statusText'}`);\n// after\nLog.warn(`[${error.statusCode}] ${error.statusText || 'empty statusText'} ${config.method?.toUpperCase()} ${config.url}`);","handlingStrategy":"try-catch","validationCode":"const res = await fetch(url, { method: 'HEAD' }).catch(() => null);\nif (!res || res.status >= 400) console.warn('API endpoint unhealthy before call');","typeGuard":"function isHttpError(e: unknown): e is AxiosError {\n  return axios.isAxiosError(e) && e.response != null;\n}","tryCatchPattern":"try {\n  await api.get('/flow');\n} catch (err) {\n  const status = axios.isAxiosError(err) ? err.response?.status : undefined;\n  if (status && status !== 401 && status !== 403) {\n    Log.warn(`Request failed with status ${status}`);\n  }\n}","preventionTips":["Read the interceptor's dedicated switch branches (401/403/etc.) before treating this warning as the root error.","Include method and URL in logged HTTP errors to make them actionable.","Monitor the backend for blank statusText responses (HTTP/2/proxies) and normalize them."],"tags":["http","axios","logging","interceptor"],"backgroundTag":"http-error-response","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}