1.5 KiB
1.5 KiB
Quick Troubleshooting: JSON Parsing Errors
🚨 Emergency Fix
If you see JSON parsing errors in logs, run this immediately:
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
- Stop the application if it's running
- Run the fix script:
python3 scripts/fix_user_data.py
- Check the output for what was fixed
- Test the application:
cargo run
- If errors persist, check the detailed guide:
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?
- Check
data-validation-guide.md
for detailed information - Look at
src/models/user.rs
for current schema requirements - Use the Rust validator in
src/utils/data_validator.rs
for detailed analysis