57 lines
1.5 KiB
Markdown
57 lines
1.5 KiB
Markdown
# Quick Troubleshooting: JSON Parsing Errors
|
|
|
|
## 🚨 Emergency Fix
|
|
|
|
If you see JSON parsing errors in logs, run this immediately:
|
|
|
|
```bash
|
|
cd projectmycelium
|
|
python3 scripts/fix_user_data.py
|
|
cargo run
|
|
```
|
|
|
|
## Common Error Patterns
|
|
|
|
### Missing Field Errors
|
|
```
|
|
missing field `field_name` at line X column Y
|
|
```
|
|
**Quick Fix:** Run `python3 scripts/fix_user_data.py` - it handles most missing fields automatically.
|
|
|
|
### Invalid Enum Variant
|
|
```
|
|
unknown variant `OldVariantName`
|
|
```
|
|
**Quick Fix:** The Python script maps old variants to new ones automatically.
|
|
|
|
### Structure Mismatch
|
|
```
|
|
invalid type: map, expected a sequence
|
|
```
|
|
**Manual Fix Required:** Check the data structure against `src/models/user.rs` definitions.
|
|
|
|
## Step-by-Step Resolution
|
|
|
|
1. **Stop the application** if it's running
|
|
2. **Run the fix script:**
|
|
```bash
|
|
python3 scripts/fix_user_data.py
|
|
```
|
|
3. **Check the output** for what was fixed
|
|
4. **Test the application:**
|
|
```bash
|
|
cargo run
|
|
```
|
|
5. **If errors persist,** check the detailed guide: [`data-validation-guide.md`](./data-validation-guide.md)
|
|
|
|
## Prevention
|
|
|
|
- Run `python3 scripts/fix_user_data.py` after pulling schema changes
|
|
- Monitor application logs for new parsing errors
|
|
- Backup user data before making manual edits
|
|
|
|
## Need Help?
|
|
|
|
1. Check [`data-validation-guide.md`](./data-validation-guide.md) for detailed information
|
|
2. Look at `src/models/user.rs` for current schema requirements
|
|
3. Use the Rust validator in `src/utils/data_validator.rs` for detailed analysis |