Browse Source

fix: add error message when no workspace folder is open for code indexing (#6227)

* fix: add error message when no workspace folder is open for code indexing

- Add 'Indexing requires an open workspace folder' error message in orchestrator.ts
- Replace hardcoded error string with translatable message using i18n
- Add translations for the error message in all 18 supported languages
- Ensures proper error handling when users attempt code indexing without a workspace

* fix: add workspace folder checks for code indexing operations

- Add null checks for codeIndexManager in webviewMessageHandler
- Show translated error message when no workspace folder is open
- Prevents crashes when users try to use indexing features without a workspace
- Uses existing translation key from orchestrator

* Update src/i18n/locales/ca/embeddings.json

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Daniel 7 months ago
parent
commit
440ec30d66

+ 57 - 3
src/core/webview/webviewMessageHandler.ts

@@ -2092,6 +2092,19 @@ export const webviewMessageHandler = async (
 							}
 						}
 					}
+				} else {
+					// No workspace open - send error status
+					provider.log("Cannot save code index settings: No workspace folder open")
+					await provider.postMessageToWebview({
+						type: "indexingStatusUpdate",
+						values: {
+							systemStatus: "Error",
+							message: t("embeddings:orchestrator.indexingRequiresWorkspace"),
+							processedItems: 0,
+							totalItems: 0,
+							currentItemUnit: "items",
+						},
+					})
 				}
 			} catch (error) {
 				provider.log(`Error saving code index settings: ${error.message || error}`)
@@ -2105,7 +2118,22 @@ export const webviewMessageHandler = async (
 		}
 
 		case "requestIndexingStatus": {
-			const status = provider.codeIndexManager!.getCurrentStatus()
+			const manager = provider.codeIndexManager
+			if (!manager) {
+				// No workspace open - send error status
+				provider.postMessageToWebview({
+					type: "indexingStatusUpdate",
+					values: {
+						systemStatus: "Error",
+						message: t("embeddings:orchestrator.indexingRequiresWorkspace"),
+						processedItems: 0,
+						totalItems: 0,
+						currentItemUnit: "items",
+					},
+				})
+				return
+			}
+			const status = manager.getCurrentStatus()
 			provider.postMessageToWebview({
 				type: "indexingStatusUpdate",
 				values: status,
@@ -2136,7 +2164,22 @@ export const webviewMessageHandler = async (
 		}
 		case "startIndexing": {
 			try {
-				const manager = provider.codeIndexManager!
+				const manager = provider.codeIndexManager
+				if (!manager) {
+					// No workspace open - send error status
+					provider.postMessageToWebview({
+						type: "indexingStatusUpdate",
+						values: {
+							systemStatus: "Error",
+							message: t("embeddings:orchestrator.indexingRequiresWorkspace"),
+							processedItems: 0,
+							totalItems: 0,
+							currentItemUnit: "items",
+						},
+					})
+					provider.log("Cannot start indexing: No workspace folder open")
+					return
+				}
 				if (manager.isFeatureEnabled && manager.isFeatureConfigured) {
 					if (!manager.isInitialized) {
 						await manager.initialize(provider.contextProxy)
@@ -2151,7 +2194,18 @@ export const webviewMessageHandler = async (
 		}
 		case "clearIndexData": {
 			try {
-				const manager = provider.codeIndexManager!
+				const manager = provider.codeIndexManager
+				if (!manager) {
+					provider.log("Cannot clear index data: No workspace folder open")
+					provider.postMessageToWebview({
+						type: "indexCleared",
+						values: {
+							success: false,
+							error: t("embeddings:orchestrator.indexingRequiresWorkspace"),
+						},
+					})
+					return
+				}
 				await manager.clearIndexData()
 				provider.postMessageToWebview({ type: "indexCleared", values: { success: true } })
 			} catch (error) {

+ 9 - 0
src/i18n/locales/ca/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "No s'ha pogut determinar la dimensió del vector per al model '{{modelId}}' amb el proveïdor '{{provider}}'. Comprova els perfils del model o la configuració.",
 		"qdrantUrlMissing": "Falta l'URL de Qdrant per crear l'emmagatzematge de vectors",
 		"codeIndexingNotConfigured": "No es poden crear serveis: La indexació de codi no està configurada correctament"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "Indexació fallida: No s'ha indexat cap bloc de codi amb èxit. Això normalment indica un problema de configuració de l'embedder.",
+		"indexingFailedCritical": "Indexació fallida: No s'ha indexat cap bloc de codi amb èxit malgrat trobar fitxers per processar. Això indica una fallida crítica de l'embedder.",
+		"fileWatcherStarted": "Monitor de fitxers iniciat.",
+		"fileWatcherStopped": "Monitor de fitxers aturat.",
+		"failedDuringInitialScan": "Ha fallat durant l'escaneig inicial: {{errorMessage}}",
+		"unknownError": "Error desconegut",
+		"indexingRequiresWorkspace": "Indexació requereix una carpeta de workspace oberta"
 	}
 }

+ 9 - 0
src/i18n/locales/de/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "Konnte die Vektordimension für Modell '{{modelId}}' mit Anbieter '{{provider}}' nicht bestimmen. Überprüfe die Modellprofile oder Konfiguration.",
 		"qdrantUrlMissing": "Qdrant-URL fehlt für die Erstellung des Vektorspeichers",
 		"codeIndexingNotConfigured": "Kann keine Dienste erstellen: Code-Indizierung ist nicht richtig konfiguriert"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "Indizierung fehlgeschlagen: Keine Code-Blöcke wurden erfolgreich indiziert. Dies deutet normalerweise auf ein Embedder-Konfigurationsproblem hin.",
+		"indexingFailedCritical": "Indizierung fehlgeschlagen: Keine Code-Blöcke wurden erfolgreich indiziert, obwohl zu verarbeitende Dateien gefunden wurden. Dies deutet auf einen kritischen Embedder-Fehler hin.",
+		"fileWatcherStarted": "Datei-Watcher gestartet.",
+		"fileWatcherStopped": "Datei-Watcher gestoppt.",
+		"failedDuringInitialScan": "Fehler während des ersten Scans: {{errorMessage}}",
+		"unknownError": "Unbekannter Fehler",
+		"indexingRequiresWorkspace": "Indexierung erfordert einen offenen Workspace-Ordner"
 	}
 }

+ 9 - 0
src/i18n/locales/en/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "Could not determine vector dimension for model '{{modelId}}' with provider '{{provider}}'. Check model profiles or configuration.",
 		"qdrantUrlMissing": "Qdrant URL missing for vector store creation",
 		"codeIndexingNotConfigured": "Cannot create services: Code indexing is not properly configured"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "Indexing failed: No code blocks were successfully indexed. This usually indicates an embedder configuration issue.",
+		"indexingFailedCritical": "Indexing failed: No code blocks were successfully indexed despite finding files to process. This indicates a critical embedder failure.",
+		"fileWatcherStarted": "File watcher started.",
+		"fileWatcherStopped": "File watcher stopped.",
+		"failedDuringInitialScan": "Failed during initial scan: {{errorMessage}}",
+		"unknownError": "Unknown error",
+		"indexingRequiresWorkspace": "Indexing requires an open workspace folder"
 	}
 }

+ 9 - 0
src/i18n/locales/es/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "No se pudo determinar la dimensión del vector para el modelo '{{modelId}}' con el proveedor '{{provider}}'. Verifica los perfiles del modelo o la configuración.",
 		"qdrantUrlMissing": "Falta la URL de Qdrant para crear el almacén de vectores",
 		"codeIndexingNotConfigured": "No se pueden crear servicios: La indexación de código no está configurada correctamente"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "Indexación fallida: No se indexaron exitosamente bloques de código. Esto usualmente indica un problema de configuración del incrustador.",
+		"indexingFailedCritical": "Indexación fallida: No se indexaron exitosamente bloques de código a pesar de encontrar archivos para procesar. Esto indica una falla crítica del incrustador.",
+		"fileWatcherStarted": "Monitor de archivos iniciado.",
+		"fileWatcherStopped": "Monitor de archivos detenido.",
+		"failedDuringInitialScan": "Falló durante el escaneo inicial: {{errorMessage}}",
+		"unknownError": "Error desconocido",
+		"indexingRequiresWorkspace": "La indexación requiere una carpeta de workspace abierta"
 	}
 }

+ 9 - 0
src/i18n/locales/fr/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "Impossible de déterminer la dimension du vecteur pour le modèle '{{modelId}}' avec le fournisseur '{{provider}}'. Vérifie les profils du modèle ou la configuration.",
 		"qdrantUrlMissing": "URL Qdrant manquante pour la création du stockage de vecteurs",
 		"codeIndexingNotConfigured": "Impossible de créer les services : L'indexation du code n'est pas correctement configurée"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "Échec de l'indexation : Aucun bloc de code n'a été indexé avec succès. Cela indique généralement un problème de configuration de l'embedder.",
+		"indexingFailedCritical": "Échec de l'indexation : Aucun bloc de code n'a été indexé avec succès malgré la découverte de fichiers à traiter. Cela indique une défaillance critique de l'embedder.",
+		"fileWatcherStarted": "Surveillant de fichiers démarré.",
+		"fileWatcherStopped": "Surveillant de fichiers arrêté.",
+		"failedDuringInitialScan": "Échec lors du scan initial : {{errorMessage}}",
+		"unknownError": "Erreur inconnue",
+		"indexingRequiresWorkspace": "L'indexation nécessite l'ouverture d'un dossier workspace"
 	}
 }

+ 9 - 0
src/i18n/locales/hi/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "प्रदाता '{{provider}}' के साथ मॉडल '{{modelId}}' के लिए वेक्टर आयाम निर्धारित नहीं कर सका। मॉडल प्रोफ़ाइल या कॉन्फ़िगरेशन की जांच करें।",
 		"qdrantUrlMissing": "वेक्टर स्टोर बनाने के लिए Qdrant URL गायब है",
 		"codeIndexingNotConfigured": "सेवाएं नहीं बना सकते: कोड इंडेक्सिंग ठीक से कॉन्फ़िगर नहीं है"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "इंडेक्सिंग असफल: कोई भी कोड ब्लॉक सफलतापूर्वक इंडेक्स नहीं हुआ। यह आमतौर पर एम्बेडर कॉन्फ़िगरेशन समस्या को दर्शाता है।",
+		"indexingFailedCritical": "इंडेक्सिंग असफल: प्रोसेस करने के लिए फाइलें मिलने के बावजूद कोई भी कोड ब्लॉक सफलतापूर्वक इंडेक्स नहीं हुआ। यह एक गंभीर एम्बेडर विफलता को दर्शाता है।",
+		"fileWatcherStarted": "फाइल वॉचर शुरू हुआ।",
+		"fileWatcherStopped": "फाइल वॉचर रुक गया।",
+		"failedDuringInitialScan": "प्रारंभिक स्कैन के दौरान असफल: {{errorMessage}}",
+		"unknownError": "अज्ञात त्रुटि",
+		"indexingRequiresWorkspace": "इंडेक्सिंग के लिए एक खुला वर्कस्पेस फ़ोल्डर आवश्यक है"
 	}
 }

+ 9 - 0
src/i18n/locales/id/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "Tidak dapat menentukan dimensi vektor untuk model '{{modelId}}' dengan penyedia '{{provider}}'. Periksa profil model atau konfigurasi.",
 		"qdrantUrlMissing": "URL Qdrant tidak ada untuk membuat penyimpanan vektor",
 		"codeIndexingNotConfigured": "Tidak dapat membuat layanan: Pengindeksan kode tidak dikonfigurasi dengan benar"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "Pengindeksan gagal: Tidak ada blok kode yang berhasil diindeks. Ini biasanya menunjukkan masalah konfigurasi embedder.",
+		"indexingFailedCritical": "Pengindeksan gagal: Tidak ada blok kode yang berhasil diindeks meskipun menemukan file untuk diproses. Ini menunjukkan kegagalan kritis embedder.",
+		"fileWatcherStarted": "Pemantau file dimulai.",
+		"fileWatcherStopped": "Pemantau file dihentikan.",
+		"failedDuringInitialScan": "Gagal selama pemindaian awal: {{errorMessage}}",
+		"unknownError": "Kesalahan tidak diketahui",
+		"indexingRequiresWorkspace": "Pengindeksan memerlukan folder workspace yang terbuka"
 	}
 }

+ 9 - 0
src/i18n/locales/it/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "Impossibile determinare la dimensione del vettore per il modello '{{modelId}}' con il provider '{{provider}}'. Controlla i profili del modello o la configurazione.",
 		"qdrantUrlMissing": "URL Qdrant mancante per la creazione dello storage vettoriale",
 		"codeIndexingNotConfigured": "Impossibile creare i servizi: L'indicizzazione del codice non è configurata correttamente"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "Indicizzazione fallita: Nessun blocco di codice è stato indicizzato con successo. Questo di solito indica un problema di configurazione dell'embedder.",
+		"indexingFailedCritical": "Indicizzazione fallita: Nessun blocco di codice è stato indicizzato con successo nonostante siano stati trovati file da elaborare. Questo indica un errore critico dell'embedder.",
+		"fileWatcherStarted": "Monitoraggio file avviato.",
+		"fileWatcherStopped": "Monitoraggio file fermato.",
+		"failedDuringInitialScan": "Fallito durante la scansione iniziale: {{errorMessage}}",
+		"unknownError": "Errore sconosciuto",
+		"indexingRequiresWorkspace": "L'indicizzazione richiede una cartella di workspace aperta"
 	}
 }

+ 9 - 0
src/i18n/locales/ja/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "プロバイダー '{{provider}}' のモデル '{{modelId}}' の埋め込み次元を決定できませんでした。モデルプロファイルまたは設定を確認してください。",
 		"qdrantUrlMissing": "ベクターストア作成のためのQdrant URLがありません",
 		"codeIndexingNotConfigured": "サービスを作成できません: コードインデックスが正しく設定されていません"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "インデックス作成に失敗しました:コードブロックが正常にインデックス化されませんでした。これは通常、エンベッダーの設定問題を示しています。",
+		"indexingFailedCritical": "インデックス作成に失敗しました:処理するファイルが見つかったにもかかわらず、コードブロックが正常にインデックス化されませんでした。これは重大なエンベッダーの障害を示しています。",
+		"fileWatcherStarted": "ファイルウォッチャーが開始されました。",
+		"fileWatcherStopped": "ファイルウォッチャーが停止されました。",
+		"failedDuringInitialScan": "初期スキャン中に失敗しました:{{errorMessage}}",
+		"unknownError": "不明なエラー",
+		"indexingRequiresWorkspace": "インデックス作成には、開かれたワークスペースフォルダーが必要です"
 	}
 }

+ 9 - 0
src/i18n/locales/ko/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "프로바이더 '{{provider}}'의 모델 '{{modelId}}'에 대한 벡터 차원을 결정할 수 없습니다. 모델 프로필 또는 구성을 확인하세요.",
 		"qdrantUrlMissing": "벡터 저장소 생성을 위한 Qdrant URL이 누락되었습니다",
 		"codeIndexingNotConfigured": "서비스를 생성할 수 없습니다: 코드 인덱싱이 올바르게 구성되지 않았습니다"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "인덱싱 실패: 코드 블록이 성공적으로 인덱싱되지 않았습니다. 이는 일반적으로 임베더 구성 문제를 나타냅니다.",
+		"indexingFailedCritical": "인덱싱 실패: 처리할 파일을 찾았음에도 불구하고 코드 블록이 성공적으로 인덱싱되지 않았습니다. 이는 중요한 임베더 오류를 나타냅니다.",
+		"fileWatcherStarted": "파일 감시자가 시작되었습니다.",
+		"fileWatcherStopped": "파일 감시자가 중지되었습니다.",
+		"failedDuringInitialScan": "초기 스캔 중 실패: {{errorMessage}}",
+		"unknownError": "알 수 없는 오류",
+		"indexingRequiresWorkspace": "인덱싱에는 열린 워크스페이스 폴더가 필요합니다"
 	}
 }

+ 9 - 0
src/i18n/locales/nl/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "Kan de vectordimensie voor model '{{modelId}}' met provider '{{provider}}' niet bepalen. Controleer modelprofielen of configuratie.",
 		"qdrantUrlMissing": "Qdrant URL ontbreekt voor het maken van vectoropslag",
 		"codeIndexingNotConfigured": "Kan geen services maken: Code-indexering is niet correct geconfigureerd"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "Indexering mislukt: Geen codeblokken werden succesvol geïndexeerd. Dit duidt meestal op een embedder configuratieprobleem.",
+		"indexingFailedCritical": "Indexering mislukt: Geen codeblokken werden succesvol geïndexeerd ondanks het vinden van bestanden om te verwerken. Dit duidt op een kritieke embedder fout.",
+		"fileWatcherStarted": "Bestandsmonitor gestart.",
+		"fileWatcherStopped": "Bestandsmonitor gestopt.",
+		"failedDuringInitialScan": "Mislukt tijdens initiële scan: {{errorMessage}}",
+		"unknownError": "Onbekende fout",
+		"indexingRequiresWorkspace": "Indexering vereist een geopende workspace map"
 	}
 }

+ 9 - 0
src/i18n/locales/pl/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "Nie można określić wymiaru wektora dla modelu '{{modelId}}' z dostawcą '{{provider}}'. Sprawdź profile modelu lub konfigurację.",
 		"qdrantUrlMissing": "Brak adresu URL Qdrant do utworzenia magazynu wektorów",
 		"codeIndexingNotConfigured": "Nie można utworzyć usług: Indeksowanie kodu nie jest poprawnie skonfigurowane"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "Indeksowanie nie powiodło się: Żadne bloki kodu nie zostały pomyślnie zaindeksowane. To zwykle wskazuje na problem z konfiguracją embeddera.",
+		"indexingFailedCritical": "Indeksowanie nie powiodło się: Żadne bloki kodu nie zostały pomyślnie zaindeksowane pomimo znalezienia plików do przetworzenia. To wskazuje na krytyczny błąd embeddera.",
+		"fileWatcherStarted": "Monitor plików uruchomiony.",
+		"fileWatcherStopped": "Monitor plików zatrzymany.",
+		"failedDuringInitialScan": "Niepowodzenie podczas początkowego skanowania: {{errorMessage}}",
+		"unknownError": "Nieznany błąd",
+		"indexingRequiresWorkspace": "Indeksowanie wymaga otwartego folderu workspace"
 	}
 }

+ 9 - 0
src/i18n/locales/pt-BR/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "Não foi possível determinar a dimensão do vetor para o modelo '{{modelId}}' com o provedor '{{provider}}'. Verifique os perfis do modelo ou a configuração.",
 		"qdrantUrlMissing": "URL do Qdrant ausente para criação do armazenamento de vetores",
 		"codeIndexingNotConfigured": "Não é possível criar serviços: A indexação de código não está configurada corretamente"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "Indexação falhou: Nenhum bloco de código foi indexado com sucesso. Isso geralmente indica um problema de configuração do embedder.",
+		"indexingFailedCritical": "Indexação falhou: Nenhum bloco de código foi indexado com sucesso apesar de encontrar arquivos para processar. Isso indica uma falha crítica do embedder.",
+		"fileWatcherStarted": "Monitor de arquivos iniciado.",
+		"fileWatcherStopped": "Monitor de arquivos parado.",
+		"failedDuringInitialScan": "Falhou durante a varredura inicial: {{errorMessage}}",
+		"unknownError": "Erro desconhecido",
+		"indexingRequiresWorkspace": "A indexação requer uma pasta de workspace aberta"
 	}
 }

+ 9 - 0
src/i18n/locales/ru/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "Не удалось определить размерность вектора для модели '{{modelId}}' с провайдером '{{provider}}'. Проверьте профили модели или конфигурацию.",
 		"qdrantUrlMissing": "Отсутствует URL Qdrant для создания векторного хранилища",
 		"codeIndexingNotConfigured": "Невозможно создать сервисы: Индексация кода не настроена должным образом"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "Индексация не удалась: Ни один блок кода не был успешно проиндексирован. Это обычно указывает на проблему конфигурации эмбеддера.",
+		"indexingFailedCritical": "Индексация не удалась: Ни один блок кода не был успешно проиндексирован, несмотря на обнаружение файлов для обработки. Это указывает на критическую ошибку эмбеддера.",
+		"fileWatcherStarted": "Наблюдатель файлов запущен.",
+		"fileWatcherStopped": "Наблюдатель файлов остановлен.",
+		"failedDuringInitialScan": "Ошибка во время первоначального сканирования: {{errorMessage}}",
+		"unknownError": "Неизвестная ошибка",
+		"indexingRequiresWorkspace": "Для индексации требуется открытая папка рабочего пространства"
 	}
 }

+ 9 - 0
src/i18n/locales/tr/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "'{{provider}}' sağlayıcısı ile '{{modelId}}' modeli için vektör boyutu belirlenemedi. Model profillerini veya yapılandırmayı kontrol et.",
 		"qdrantUrlMissing": "Vektör deposu oluşturmak için Qdrant URL'si eksik",
 		"codeIndexingNotConfigured": "Hizmetler oluşturulamıyor: Kod indeksleme düzgün yapılandırılmamış"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "İndeksleme başarısız: Hiçbir kod bloğu başarıyla indekslenemedi. Bu genellikle bir embedder yapılandırma sorunu olduğunu gösterir.",
+		"indexingFailedCritical": "İndeksleme başarısız: İşlenecek dosyalar bulunmasına rağmen hiçbir kod bloğu başarıyla indekslenemedi. Bu kritik bir embedder hatası olduğunu gösterir.",
+		"fileWatcherStarted": "Dosya izleyici başlatıldı.",
+		"fileWatcherStopped": "Dosya izleyici durduruldu.",
+		"failedDuringInitialScan": "İlk tarama sırasında başarısız: {{errorMessage}}",
+		"unknownError": "Bilinmeyen hata",
+		"indexingRequiresWorkspace": "İndeksleme açık bir workspace klasörü gerektirir"
 	}
 }

+ 9 - 0
src/i18n/locales/vi/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "Không thể xác định kích thước vector cho mô hình '{{modelId}}' với nhà cung cấp '{{provider}}'. Kiểm tra hồ sơ mô hình hoặc cấu hình.",
 		"qdrantUrlMissing": "Thiếu URL Qdrant để tạo kho lưu trữ vector",
 		"codeIndexingNotConfigured": "Không thể tạo dịch vụ: Lập chỉ mục mã không được cấu hình đúng cách"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "Lập chỉ mục thất bại: Không có khối mã nào được lập chỉ mục thành công. Điều này thường cho thấy vấn đề cấu hình embedder.",
+		"indexingFailedCritical": "Lập chỉ mục thất bại: Không có khối mã nào được lập chỉ mục thành công mặc dù đã tìm thấy tệp để xử lý. Điều này cho thấy lỗi nghiêm trọng của embedder.",
+		"fileWatcherStarted": "Trình theo dõi tệp đã khởi động.",
+		"fileWatcherStopped": "Trình theo dõi tệp đã dừng.",
+		"failedDuringInitialScan": "Thất bại trong quá trình quét ban đầu: {{errorMessage}}",
+		"unknownError": "Lỗi không xác định",
+		"indexingRequiresWorkspace": "Lập chỉ mục yêu cầu một thư mục workspace đang mở"
 	}
 }

+ 9 - 0
src/i18n/locales/zh-CN/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "无法确定提供商 '{{provider}}' 的模型 '{{modelId}}' 的向量维度。请检查模型配置文件或配置。",
 		"qdrantUrlMissing": "创建向量存储缺少 Qdrant URL",
 		"codeIndexingNotConfigured": "无法创建服务:代码索引未正确配置"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "索引失败:没有代码块被成功索引。这通常表示 Embedder 配置问题。",
+		"indexingFailedCritical": "索引失败:尽管找到了要处理的文件,但没有代码块被成功索引。这表示 Embedder 出现严重故障。",
+		"fileWatcherStarted": "文件监控已启动。",
+		"fileWatcherStopped": "文件监控已停止。",
+		"failedDuringInitialScan": "初始扫描失败:{{errorMessage}}",
+		"unknownError": "未知错误",
+		"indexingRequiresWorkspace": "索引需要打开的工作区文件夹"
 	}
 }

+ 9 - 0
src/i18n/locales/zh-TW/embeddings.json

@@ -52,5 +52,14 @@
 		"vectorDimensionNotDetermined": "無法確定提供商 '{{provider}}' 的模型 '{{modelId}}' 的向量維度。請檢查模型設定檔或設定。",
 		"qdrantUrlMissing": "建立向量儲存缺少 Qdrant URL",
 		"codeIndexingNotConfigured": "無法建立服務:程式碼索引未正確設定"
+	},
+	"orchestrator": {
+		"indexingFailedNoBlocks": "索引失敗:沒有程式碼區塊被成功索引。這通常表示 Embedder 設定問題。",
+		"indexingFailedCritical": "索引失敗:儘管找到了要處理的檔案,但沒有程式碼區塊被成功索引。這表示 Embedder 出現嚴重故障。",
+		"fileWatcherStarted": "檔案監控已啟動。",
+		"fileWatcherStopped": "檔案監控已停止。",
+		"failedDuringInitialScan": "初始掃描失敗:{{errorMessage}}",
+		"unknownError": "未知錯誤",
+		"indexingRequiresWorkspace": "索引需要開啟的工作區資料夾"
 	}
 }

+ 18 - 9
src/services/code-index/orchestrator.ts

@@ -7,6 +7,7 @@ import { DirectoryScanner } from "./processors"
 import { CacheManager } from "./cache-manager"
 import { TelemetryService } from "@roo-code/telemetry"
 import { TelemetryEventName } from "@roo-code/types"
+import { t } from "../../i18n"
 
 /**
  * Manages the code indexing workflow, coordinating between different services and managers.
@@ -94,6 +95,13 @@ export class CodeIndexOrchestrator {
 	 * Initiates the indexing process (initial scan and starts watcher).
 	 */
 	public async startIndexing(): Promise<void> {
+		// Check if workspace is available first
+		if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length === 0) {
+			this.stateManager.setSystemState("Error", t("embeddings:orchestrator.indexingRequiresWorkspace"))
+			console.warn("[CodeIndexOrchestrator] Start rejected: No workspace folder open.")
+			return
+		}
+
 		if (!this.configManager.isFeatureConfigured) {
 			this.stateManager.setSystemState("Standby", "Missing configuration. Save your settings to start indexing.")
 			console.warn("[CodeIndexOrchestrator] Start rejected: Missing configuration.")
@@ -165,9 +173,7 @@ export class CodeIndexOrchestrator {
 					const firstError = batchErrors[0]
 					throw new Error(`Indexing failed: ${firstError.message}`)
 				} else {
-					throw new Error(
-						"Indexing failed: No code blocks were successfully indexed. This usually indicates an embedder configuration issue.",
-					)
+					throw new Error(t("embeddings:orchestrator.indexingFailedNoBlocks"))
 				}
 			}
 
@@ -191,14 +197,12 @@ export class CodeIndexOrchestrator {
 			// Final sanity check: If we found blocks but indexed none and somehow no errors were reported,
 			// this is still a failure
 			if (cumulativeBlocksFoundSoFar > 0 && cumulativeBlocksIndexed === 0) {
-				throw new Error(
-					"Indexing failed: No code blocks were successfully indexed despite finding files to process. This indicates a critical embedder failure.",
-				)
+				throw new Error(t("embeddings:orchestrator.indexingFailedCritical"))
 			}
 
 			await this._startWatcher()
 
-			this.stateManager.setSystemState("Indexed", "File watcher started.")
+			this.stateManager.setSystemState("Indexed", t("embeddings:orchestrator.fileWatcherStarted"))
 		} catch (error: any) {
 			console.error("[CodeIndexOrchestrator] Error during indexing:", error)
 			TelemetryService.instance.captureEvent(TelemetryEventName.CODE_INDEX_ERROR, {
@@ -219,7 +223,12 @@ export class CodeIndexOrchestrator {
 
 			await this.cacheManager.clearCacheFile()
 
-			this.stateManager.setSystemState("Error", `Failed during initial scan: ${error.message || "Unknown error"}`)
+			this.stateManager.setSystemState(
+				"Error",
+				t("embeddings:orchestrator.failedDuringInitialScan", {
+					errorMessage: error.message || t("embeddings:orchestrator.unknownError"),
+				}),
+			)
 			this.stopWatcher()
 		} finally {
 			this._isProcessing = false
@@ -235,7 +244,7 @@ export class CodeIndexOrchestrator {
 		this._fileWatcherSubscriptions = []
 
 		if (this.stateManager.state !== "Error") {
-			this.stateManager.setSystemState("Standby", "File watcher stopped.")
+			this.stateManager.setSystemState("Standby", t("embeddings:orchestrator.fileWatcherStopped"))
 		}
 		this._isProcessing = false
 	}