sqlite_graphrag/i18n/validation/
app_error_pt.rs1pub fn validation(msg: &str) -> String {
3 format!("erro de validação: {msg}")
4}
5
6pub fn duplicate(msg: &str) -> String {
8 let translated = msg
9 .replace("already exists in namespace", "já existe no namespace")
10 .replace(
11 "exists but is soft-deleted in namespace",
12 "existe mas está excluída temporariamente no namespace",
13 )
14 .replace(
15 "Use --force-merge to update.",
16 "Use --force-merge para atualizar.",
17 )
18 .replace(
19 "use --force-merge to restore and update, or `restore` to revive it",
20 "use --force-merge para restaurar e atualizar, ou `restore` para revivê-la",
21 )
22 .replace("memory", "memória");
23 format!("duplicata detectada: {translated}")
24}
25
26pub fn conflict(msg: &str) -> String {
28 let translated = msg
29 .replace("optimistic lock conflict", "conflito de lock otimista")
30 .replace("but current is", "mas atual é")
31 .replace(
32 "was modified by another process",
33 "foi modificada por outro processo",
34 );
35 format!("conflito: {translated}")
36}
37
38pub fn not_found(msg: &str) -> String {
40 let translated = msg
61 .replace("source entity '", "entidade de origem '")
63 .replace("target entity '", "entidade de destino '")
64 .replace("memory not found:", "memória não encontrada:")
66 .replace(
67 "exists but belongs to namespace",
68 "existe mas pertence ao namespace",
69 )
70 .replace("' not found in namespace", "' não encontrada no namespace")
71 .replace("not found in namespace", "não encontrado no namespace")
72 .replace(
73 "not found in pending_memories",
74 "não encontrado em pending_memories",
75 )
76 .replace("not found for memory", "não encontrada para memória")
77 .replace("does not exist in namespace", "não existe no namespace")
78 .replace("memory or entity", "memória ou entidade")
79 .replace("Did you mean:", "Você quis dizer:")
80 .replace(
81 "Re-run with --fuzzy to auto-resolve a clear match, or pass the canonical name.",
82 "Repita com --fuzzy para resolver automaticamente uma correspondência clara, \
83 ou informe o nome canônico.",
84 )
85 .replace(
86 "is not held (no file at",
87 "não está retido (nenhum arquivo em",
88 )
89 .replace("no key with fingerprint", "nenhuma chave com fingerprint")
90 .replace("name='", "nome='")
91 .replace("relationship", "relacionamento")
93 .replace("edge '", "aresta '")
94 .replace("memory", "memória")
95 .replace("entity", "entidade")
96 .replace("' not found", "' não encontrada")
98 .replace("not found", "não encontrado")
99 .replace(", not '", ", e não '")
101 .replace(" in namespace '", " no namespace '")
102 .replace("version", "versão")
103 .replace("soft-deleted", "excluída temporariamente");
104 format!("não encontrado: {translated}")
105}
106
107pub fn memory_not_found(name: &str, namespace: &str) -> String {
112 not_found(&format!(
113 "memory not found: name='{name}' in namespace '{namespace}'"
114 ))
115}
116
117pub fn memory_not_found_by_id(id: i64) -> String {
119 not_found(&format!("memory not found: id={id}"))
120}
121
122pub fn entity_not_yet_materialized(name: &str, namespace: &str) -> String {
126 format!("entidade '{name}' ainda não materializada no namespace '{namespace}'")
127}
128
129pub fn namespace_error(msg: &str) -> String {
131 format!("namespace não resolvido: {msg}")
132}
133
134pub fn limit_exceeded(msg: &str) -> String {
136 let translated = msg
137 .replace("exceeds limit of", "excede limite de")
138 .replace("body exceeds", "corpo excede")
139 .replace("entities exceed limit", "entidades excedem limite")
140 .replace(
141 "relationships exceed limit",
142 "relacionamentos excedem limite",
143 );
144 format!("limite excedido: {translated}")
145}
146
147pub fn body_too_large(bytes: u64, limit: u64) -> String {
152 format!(
153 "limite excedido: corpo tem {bytes} bytes, acima do teto de {limit} bytes \
154 (MAX_MEMORY_BODY_LEN); divida o conteúdo em múltiplas memórias"
155 )
156}
157
158pub fn too_many_chunks(chunks: usize, limit: usize) -> String {
160 format!(
161 "limite excedido: documento produz {chunks} chunks, acima do teto de {limit} \
162 chunks (REMEMBER_MAX_SAFE_MULTI_CHUNKS); divida o documento antes da escrita"
163 )
164}
165
166pub fn too_many_tokens(tokens: u64, limit: u64) -> String {
170 format!(
171 "limite excedido: corpo tem {tokens} tokens (estimado), acima do teto de \
172 {limit} tokens (EMBEDDING_REQUEST_MAX_TOKENS); divida o conteúdo em \
173 múltiplas memórias"
174 )
175}
176
177pub fn database(err: &str) -> String {
179 format!("erro de banco de dados: {err}")
180}
181
182pub fn embedding(msg: &str) -> String {
184 format!("erro de embedding: {msg}")
185}
186
187pub fn vec_extension(msg: &str) -> String {
189 format!("extensão sqlite-vec falhou: {msg}")
190}
191
192pub fn provider_error(code: &str, message: &str) -> String {
194 format!("erro do provedor (código {code}): {message}")
195}
196
197pub fn db_busy(msg: &str) -> String {
199 format!("banco ocupado: {msg}")
200}
201
202pub fn batch_partial_failure(total: usize, failed: usize) -> String {
204 format!("falha parcial em batch: {failed} de {total} itens falharam")
205}
206
207pub fn io(err: &str) -> String {
209 format!("erro de I/O: {err}")
210}
211
212pub fn internal(err: &str) -> String {
214 format!("erro interno: {err}")
215}
216
217pub fn json(err: &str) -> String {
219 format!("erro de JSON: {err}")
220}
221
222pub fn lock_busy(msg: &str) -> String {
224 format!("lock ocupado: {msg}")
225}
226
227pub fn all_slots_full(max: usize, waited_secs: u64) -> String {
229 format!(
230 "todos os {max} slots de concorrência ocupados após aguardar {waited_secs}s \
231 (exit 75); use --max-concurrency ou aguarde outras invocações terminarem"
232 )
233}
234
235pub fn job_singleton_locked(job_type: &str, namespace: &str) -> String {
237 format!(
238 "job {job_type} para o namespace '{namespace}' já está em execução (exit 75); \
239 aguarde a conclusão ou passe --wait-job-singleton <SEGUNDOS>"
240 )
241}
242
243pub fn embedding_singleton_locked(namespace: &str) -> String {
245 format!(
246 "singleton de embedding para o namespace '{namespace}' já está retido (exit 75); \
247 outra CLI está chamando o LLM neste banco; passe --wait-embed-singleton <SEGUNDOS> para aguardar"
248 )
249}
250
251pub fn low_memory(available_mb: u64, required_mb: u64) -> String {
253 format!(
254 "memória disponível ({available_mb}MB) abaixo do mínimo requerido ({required_mb}MB) \
255 para carregar o modelo; aborte outras cargas ou use --skip-memory-guard (exit 77)"
256 )
257}
258
259pub fn shutdown(signal: &str) -> String {
261 format!("sinal de desligamento recebido: {signal}; operação cancelada pelo usuário (exit 19)")
262}
263
264pub fn binary_not_found(name: &str) -> String {
271 format!("binário não encontrado: {name} — instale e adicione ao PATH")
272}
273
274pub fn rate_limited(detail: &str) -> String {
276 format!("taxa de requisição excedida: {detail}")
277}
278
279pub fn timeout(operation: &str, secs: u64) -> String {
281 format!("timeout após {secs}s: {operation}")
282}