# ⚠️ Troubleshoot - Erro ao Rodar ## Problema: "An unhandled error has occurred" ### ✅ Solução (3 passos) #### 1. **Abra PRIMEIRO terminal** ```bash cd /mnt/c/vscode/VideoStudy.app/VideoStudy.API dotnet run ``` **Espere até ver:** ``` info: Microsoft.Hosting.Lifetime[14] Now listening on: http://localhost:5000 Press CTRL+C to quit ``` #### 2. **Abra SEGUNDO terminal** (enquanto o primeiro está rodando) ```bash cd /mnt/c/vscode/VideoStudy.app/VideoStudy.Desktop/VideoStudy.Desktop dotnet run ``` **Espere até ver:** ``` info: Microsoft.Hosting.Lifetime[14] Now listening on: http://localhost:5001 Press CTRL+C to quit ``` #### 3. **Abra browser** ``` http://localhost:5001 ``` ✅ Agora sim, formatação OK e funciona! --- ## ❌ Erros Comuns ### Erro: "Cannot connect to API" - **Causa:** API não está rodando no terminal 1 - **Solução:** Certifique-se que tem DOIS terminais abertos ### Erro: "Connection refused" - **Causa:** Desktop tenta conectar na API antes dela estar pronta - **Solução:** Aguarde a API mostrar "Now listening on: http://localhost:5000" ### Erro: "JSON deserialization error" - **Causa:** Versão desatualizada, cache do navegador - **Solução:** - Pressione `Ctrl+Shift+Delete` no browser (limpar cache) - Ou abra em modo anônimo/privado - Ou tente em outro browser ### Erro ao build: "Unable to find fallback package" - **Causa:** Problema NuGet no Linux - **Solução:** ```bash # Ignore e tente novamente dotnet restore dotnet build ``` --- ## 🔍 Debug - Como ver erros ### 1. **Console do Browser (F12)** - Pressione `F12` - Vá para aba "Console" - Veja erros JavaScript lá ### 2. **Debug Logs da App** - Vá para aba "Debug Logs" na página - Mostra cada etapa do processamento - Útil para entender o fluxo ### 3. **Terminal da API** - Se houver erro na API, aparece no terminal 1 - Se houver erro no Desktop, aparece no terminal 2 --- ## 🚀 Teste Rápido Se quer testar só a API sem Desktop: ```bash curl http://localhost:5000/health ``` Deve retornar: ```json {"status":"ok","timestamp":"2026-02-06T..."} ``` Testar análise: ```bash curl -X POST http://localhost:5000/api/analyze \ -H "Content-Type: application/json" \ -d '{"videoUrl":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","language":"en","mode":"fast"}' ``` --- ## 📝 Checklist ANTES de rodar - [ ] Você tem o .NET 8.0 SDK? `dotnet --version` - [ ] A porta 5000 está livre? `netstat -ano | findstr :5000` - [ ] A porta 5001 está livre? `netstat -ano | findstr :5001` - [ ] Você abriu DOIS terminais separados? - [ ] Esperou a API dizer "Now listening"? - [ ] Esperou o Desktop dizer "Now listening"? - [ ] Abriu http://localhost:5001 no browser? --- ## 💡 Se ainda não funcionar 1. **Limpe tudo:** ```bash dotnet clean dotnet restore dotnet build ``` 2. **Reabra os terminais:** ```bash # Terminal 1 cd VideoStudy.API && dotnet run # Terminal 2 (NOVO, não o mesmo) cd VideoStudy.Desktop/VideoStudy.Desktop && dotnet run ``` 3. **Refresh do browser:** - `Ctrl+F5` ou `Cmd+Shift+R` (hard refresh) - Ou `Ctrl+Shift+Delete` (limpar cache) --- ## 📞 Informações para Debug Quando reportar erro, envie: 1. **Screenshot com erro** 2. **Console output (F12 → Console)** 3. **Debug logs da app** (aba Debug Logs) 4. **Erro do terminal** (ambos os terminais) --- **Data:** 2026-02-06 **Última atualização:** FASE 1 + Correção de Formatação