{"record":{"id":"68655a0594f92788","repo":"Zackriya-Solutions/meetily","slug":"summary-model-recommendation-is-not-ready-yet","errorCode":null,"errorMessage":"Summary model recommendation is not ready yet","messagePattern":"Summary model recommendation is not ready yet","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/components/onboarding/steps/DownloadProgressStep.tsx","lineNumber":131,"sourceCode":"    console.log('[DownloadProgressStep] Retrying summary model download');\n    retryingSummaryRef.current = true;\n\n    // Reset error state\n    setSummaryState((prev) => ({\n      ...prev,\n      status: 'downloading',\n      error: undefined,\n      progress: 0,\n      downloadedMb: 0,\n      totalMb: getSummaryModelSizeMb(selectedSummaryModel || recommendedSummaryModel),\n      speedMbps: 0,\n    }));\n\n    try {\n      // Call download command directly (no retry command exists for built-in AI)\n      const modelName = selectedSummaryModel;\n      if (!modelName) {\n        throw new Error('Summary model recommendation is not ready yet');\n      }\n      await invoke('builtin_ai_download_model', { modelName });\n    } catch (error) {\n      console.error('[DownloadProgressStep] Summary retry failed:', error);\n      setSummaryState((prev) => ({\n        ...prev,\n        status: 'error',\n        error: error instanceof Error ? error.message : 'Retry failed',\n      }));\n\n      toast.error('Summary model download retry failed', {\n        description: 'Please check your connection and try again.',\n      });\n    } finally {\n      // Allow retry again after 2 seconds\n      setTimeout(() => {\n        retryingSummaryRef.current = false;\n      }, 2000);","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src/components/onboarding/steps/DownloadProgressStep.tsx#L113-L149","documentation":"In DownloadProgressStep's retry handler, the summary download invokes builtin_ai_download_model with selectedSummaryModel and throws before the invoke when that state is null. selectedSummaryModel is populated asynchronously from the model-recommendation flow, so clicking Retry before that resolves hits the guard. Note the size calculation two lines above already falls back to recommendedSummaryModel, but the download itself does not — an inconsistency that makes this reachable even when a recommendation exists.","triggerScenarios":"User clicks Retry on the summary download card before the async recommendation request resolves; the recommendation request failed silently leaving selectedSummaryModel null; component remounted mid-onboarding and state had not rehydrated.","commonSituations":"Slow backend recommendation on first launch, clicking through onboarding quickly, or a retried download after a network error where the recommendation promise was never re-fetched.","solutions":["Disable the Retry button until selectedSummaryModel (or recommendedSummaryModel) is non-null.","Fall back to recommendedSummaryModel for the invoke, mirroring the getSummaryModelSizeMb call just above.","Await the recommendation when the onboarding step mounts and render a loading state until it resolves.","On failure, keep status 'error' with a message explaining the model suggestion hasn't loaded yet."],"exampleFix":"// before\nconst modelName = selectedSummaryModel;\nif (!modelName) {\n  throw new Error('Summary model recommendation is not ready yet');\n}\nawait invoke('builtin_ai_download_model', { modelName });\n\n// after\nconst modelName = selectedSummaryModel ?? recommendedSummaryModel;\nif (!modelName) {\n  setSummaryState(p => ({ ...p, status: 'error', error: 'Model suggestion not loaded yet — try again in a moment.' }));\n  return;\n}\nawait invoke('builtin_ai_download_model', { modelName });\n// and disable the button until a model name exists:\n// <button disabled={!selectedSummaryModel && !recommendedSummaryModel}>Retry</button>","handlingStrategy":"validation","validationCode":"const model = selectedSummaryModel ?? recommendedSummaryModel;\nif (!model) {\n  setSummaryState(p => ({ ...p, status: 'error', error: 'Model recommendation still loading — try again shortly.' }));\n  return;\n}\nawait invoke('builtin_ai_download_model', { modelName: model });","typeGuard":"const isModelName = (m: unknown): m is string => typeof m === 'string' && m.trim().length > 0;","tryCatchPattern":"try {\n  await invoke('builtin_ai_download_model', { modelName: model });\n} catch (e) {\n  const msg = e instanceof Error ? e.message : String(e);\n  setSummaryState(p => ({ ...p, status: 'error', error: msg }));\n}","preventionTips":["Disable Retry until the recommendation promise resolves.","Await the recommendation when the onboarding step mounts and show a skeleton while pending.","Persist the last recommended model so a slow re-fetch doesn't strand the retry button."],"tags":["onboarding","model-download","null-guard","tauri-invoke"],"backgroundTag":"async-state-not-ready","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}