diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 4b54cbb0af..f55a2bdbd6 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1511,8 +1511,19 @@ export class ClineProvider async showTaskWithId(id: string) { if (id !== this.getCurrentTask()?.taskId) { // Non-current task. - const { historyItem } = await this.getTaskWithId(id) - await this.createTaskWithHistoryItem(historyItem) // Clears existing task. + try { + const { historyItem } = await this.getTaskWithId(id) + await this.createTaskWithHistoryItem(historyItem) // Clears existing task. + } catch (error) { + // Log the error for debugging purposes + this.log(`Failed to load task ${id}: ${error instanceof Error ? error.message : String(error)}`) + + // Task not found or corrupt - it has already been deleted from state by getTaskWithId + vscode.window.showErrorMessage(t("common:errors.task_corrupt_deleted")) + // Refresh the webview to update the task list + await this.postStateToWebview() + return + } } await this.postMessageToWebview({ type: "action", action: "chatButtonClicked" }) diff --git a/src/i18n/locales/ca/common.json b/src/i18n/locales/ca/common.json index a1f528ef97..5d98d6b616 100644 --- a/src/i18n/locales/ca/common.json +++ b/src/i18n/locales/ca/common.json @@ -125,7 +125,8 @@ "manual_url_missing_params": "URL de callback no vàlida: falten paràmetres requerits (code i state)", "manual_url_auth_failed": "Autenticació manual per URL ha fallat", "manual_url_auth_error": "Autenticació fallida", - "mode_import_failed": "Ha fallat la importació del mode: {{error}}" + "mode_import_failed": "Ha fallat la importació del mode: {{error}}", + "task_corrupt_deleted": "La tasca seleccionada no s'ha pogut carregar i s'ha eliminat de l'historial. Això sol passar quan els fitxers de la tasca estan corruptes o falten." }, "warnings": { "no_terminal_content": "No s'ha seleccionat contingut de terminal",