Troubleshooting
Common issues and solutions when using FakeDataDSL.
Common Errors
ParseError
Problem: Schema syntax error
# Error: ParseError: Unexpected token at line 3
User:
id: uuid
name: name
email # Missing colon
Solution: Check syntax, ensure all fields have colons
User:
id: uuid
name: name
email: email # Fixed
UnknownTypeError
Problem: Type not recognized
# Error: UnknownTypeError: Unknown type 'mytype'
User:
value: mytype
Solution: Register the type or use correct type name
# Option 1: Register custom type
FakeDataDSL.register_type(:mytype) { |rng| "value" }
# Option 2: Use correct type name
User:
value: text
CyclicReferenceError
Problem: Circular references between schemas
# Error: CyclicReferenceError
User:
order_id: reference(Order, id)
Order:
user_id: reference(User, id)
Solution: Break the cycle or use different approach
# Option 1: Remove one reference
User:
id: uuid
Order:
user_id: reference(User, id)
# Option 2: Use separate field
User:
id: uuid
orders: array(reference(Order, id))
RecursionLimitError
Problem: Too deep recursion
# Error: RecursionLimitError
# Deeply nested references
Solution: Increase limit or reduce nesting
# Increase limit
FakeDataDSL.configure do |config|
config.max_recursion = 20
end
# Or reduce nesting depth
UniquenessError
Problem: Cannot satisfy uniqueness constraint
# Error: UniquenessError
User:
email: email unique # Only 2 possible values, but need 100 unique
Solution: Use more diverse types or remove uniqueness
# Option 1: Use more diverse type
User:
email: email # Remove unique if not needed
# Option 2: Use UUID for guaranteed uniqueness
User:
id: uuid unique
Performance Issues
Slow Generation
Problem: Generation is too slow
Solutions:
- Reduce latency behaviors
- Use simpler types
- Increase resource limits
- Use streaming for large datasets
# Remove latency
User:
# @latency 100ms # Remove if not needed
id: uuid
name: name
Memory Issues
Problem: Out of memory with large datasets
Solution: Use streaming
# Good - memory efficient
schema.generate_many_stream(100000).each do |record|
process(record)
end
# Bad - loads all into memory
records = schema.generate_many(100000)
Data Quality Issues
Unrealistic Data
Problem: Generated data doesn't look realistic
Solution: Use appropriate types and ranges
# Good - realistic
User:
age: number(18..65)
email: email
created_at: past_date(days: 365)
# Bad - unrealistic
User:
age: number(0..1000)
email: text
created_at: text
Missing Fields
Problem: Fields are sometimes missing
Solution: Check for optional/partial_data behaviors
# Remove optional if not needed
User:
# phone: phone optional # Remove optional
phone: phone
Configuration Issues
Seed Not Working
Problem: Different data with same seed
Solution: Ensure seed is set before generation
# Good - set seed first
FakeDataDSL.configure { |c| c.seed = 12345 }
record = schema.generate
# Bad - set seed after
record = schema.generate
FakeDataDSL.configure { |c| c.seed = 12345 }
Getting Help
- Check Examples for usage patterns
- Review DSL Reference for syntax
- See Best Practices for recommendations
- Open an issue on GitHub