{"record":{"id":"eadaf501ae843d40","repo":"QuantumNous/new-api","slug":"please-try-again-later","errorCode":null,"errorMessage":"Please try again later.","messagePattern":"Please try again later\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"web/src/features/dashboard/lib/flow-selection.ts","lineNumber":37,"sourceCode":"import type {\n  FlowQuotaDataItem,\n  FlowUserFilterOption,\n} from '@/features/dashboard/types'\n\nexport type FlowDisplayState = 'loading' | 'error' | 'empty' | 'chart'\n\nexport interface FlowResponse {\n  success: boolean\n  data?: FlowQuotaDataItem[]\n  message?: string\n}\n\nexport function requireSuccessfulFlowRows(\n  response: FlowResponse,\n  fallbackMessage: string\n): FlowQuotaDataItem[] {\n  if (!response.success) {\n    throw new Error(response.message || fallbackMessage)\n  }\n  return response.data ?? []\n}\n\nexport function flowDisplayState(options: {\n  isLoading: boolean\n  isError: boolean\n  linkCount: number\n  themeReady: boolean\n}): FlowDisplayState {\n  if (options.isLoading) return 'loading'\n  if (options.isError) return 'error'\n  if (options.linkCount === 0) return 'empty'\n  if (!options.themeReady) return 'loading'\n  return 'chart'\n}\n\nexport function compactFlowSelectionLabel(count: number): string {","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/QuantumNous/new-api/blob/e2c7aa7b102c2075eae2377df3508658d45e88dc/web/src/features/dashboard/lib/flow-selection.ts#L19-L55","documentation":"Thrown by requireSuccessfulFlowRows in the dashboard flow/quota selection lib when a flow API response has success:false and carries no message of its own. It is the fallback string passed by the caller (default 'Please try again later.'), surfaced to the dashboard's error display state via flowDisplayState(isError). It represents a failed flow-quota fetch with an unspecified server reason.","triggerScenarios":"Any dashboard flow request whose response JSON has success:false and an empty/absent message field — e.g. GET of flow quota rows returning {success:false} with no message.","commonSituations":"Backend exception without a localized message; gateway returning a bare failure envelope; rate limiting or partial outage returning success:false; version skew where a new field is required but missing and the backend fails generically.","solutions":["Inspect the failing flow request's response body in the browser network tab to find the real failure (status code plus envelope).","Check backend logs for the corresponding request to find the unnamed error.","Retry after the backend recovers; if the response can carry a message, have the backend include one so the UI shows the true cause instead of the fallback."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isFlowResponse(value: unknown): value is FlowResponse {\n  return typeof value === 'object' && value !== null && typeof (value as any).success === 'boolean'\n}","tryCatchPattern":"try {\n  rows = requireSuccessfulFlowRows(response, t('Please try again later.'))\n} catch (error) {\n  // flowDisplayState({isError:true}) already renders an error state; keep the message for tooltips\n}","preventionTips":["Have the backend always attach a message when returning success:false so the fallback rarely fires","Use React Query retry:1 for flow endpoints to absorb single-shot backend hiccups"],"tags":["dashboard","flow","fallback-message","api-envelope"],"backgroundTag":null,"analyzedSha":"e2c7aa7b102c2075eae2377df3508658d45e88dc","analyzedAt":"2026-08-15T10:35:18.111Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}