Troubleshooting¶
Common issues and solutions when using grai.build.
Installation Issues¶
"Command 'grai' not found"¶
Problem: After installing grai-build, the grai
command is not available.
Solutions:
- Check if installed:
- Install in development mode:
- Check PATH:
- Reinstall:
"Module not found" errors¶
Problem: Import errors when running grai commands.
Solution: Install all required dependencies:
Or install with dev dependencies:
Project Configuration Issues¶
"No grai.yml found"¶
Problem: grai
commands fail with "No grai.yml found in current directory or parents".
Solutions:
- Check current directory:
- Navigate to project directory:
- Specify project directory:
- Initialize a new project:
"Invalid YAML syntax"¶
Problem: YAML parsing errors in entity or relation files.
Common issues:
- Incorrect indentation (must use spaces, not tabs):
# ❌ Wrong
entity: customer
properties:
- name: id
# ✅ Correct
entity: customer
properties:
- name: id
- Missing colons:
- Unquoted special characters:
Debug YAML syntax:
Validation Issues¶
"Entity not found" in relation¶
Problem: Relation references an entity that doesn't exist.
Solution: Ensure the entity file exists and has the correct name:
# relations/purchased.yml
relation: PURCHASED
from: customer # Must match entity: customer in entities/customer.yml
to: product # Must match entity: product in entities/product.yml
Check entity names:
"Missing required field"¶
Problem: Validation fails due to missing required fields.
Required fields for entities:
entity: customer # Required
source: db.customers # Required (can be null for schema-only)
keys: [id] # Required
properties: # Required (can be empty list)
- name: id # Required
type: string # Required
Required fields for relations:
relation: PURCHASED # Required
from: customer # Required
to: product # Required
source: db.orders # Required (can be null for schema-only)
mappings: # Required
from_key: customer_id # Required
to_key: product_id # Required
Neo4j Connection Issues¶
"Cannot connect to Neo4j"¶
Problem: grai run
fails to connect to Neo4j.
Solutions:
- Check Neo4j is running:
- Test connection:
- Verify credentials:
- Check firewall:
"Authentication failed"¶
Problem: Invalid credentials for Neo4j.
Solutions:
-
Check default password: For fresh Neo4j install, default password is usually
neo4j
. You'll be prompted to change it on first login. -
Reset password:
# For Docker
docker exec -it neo4j neo4j-admin set-initial-password newpassword
# For local install
neo4j-admin set-initial-password newpassword
- Use environment variables:
"Database not found"¶
Problem: Specified database doesn't exist in Neo4j.
Solution: Create the database or use default neo4j
database:
Or update your grai.yml
:
Data Loading Issues¶
"NULL values in key fields"¶
Problem: Data loading succeeds but no nodes appear in Neo4j. Verbose mode shows NULL values in key fields.
Cause: Neo4j MERGE cannot use NULL values in pattern matching.
Solutions:
- Filter NULLs in source query:
- Use different key:
- Generate IDs for NULLs:
Debug with verbose mode:
Look for output like:
"No data loaded" but no errors¶
Problem: grai load
reports success but no data appears in database.
Solutions:
- Use verbose mode to see what's happening:
- Check data source connection:
- Verify source query:
# Test your source query directly
bq query --use_legacy_sql=false "SELECT * FROM your_dataset.your_table LIMIT 10"
- Check batch size:
Build and Compilation Issues¶
"Cypher compilation failed"¶
Problem: grai build
fails to generate valid Cypher.
Solutions:
- Validate first:
- Check generated Cypher:
- Test Cypher manually: Copy generated Cypher into Neo4j Browser and run it to see the actual error.
"Output directory not found"¶
Problem: Build fails because target directory doesn't exist.
Solution: grai should create it automatically, but you can create it manually:
Visualization Issues¶
"Visualization won't open"¶
Problem: grai visualize --open
doesn't open browser.
Solutions:
- Open manually:
grai visualize --format d3
# Then open the file shown in output
open target/visualizations/graph-d3.html
- Check default browser:
- Check file was created:
Performance Issues¶
"Slow validation"¶
Problem: grai validate
takes a long time on large projects.
Solutions:
- Use build cache:
- Validate specific files:
- Disable strict mode:
"Slow data loading"¶
Problem: grai load
is very slow.
Solutions:
- Increase batch size:
- Use limit for testing:
- Load entities in parallel:
Common Errors and Solutions¶
Pydantic ValidationError¶
Error:
Solution: Check your YAML matches the required schema:
entity: customer
source: analytics.customers
keys: [customer_id] # Must be a list
properties: # Must be a list of objects
- name: customer_id
type: string
FileNotFoundError¶
Error:
Solution: Check file path and current directory:
YAML ParsingError¶
Error:
Solution: Check YAML indentation and syntax:
Getting Help¶
If you're still stuck:
-
Check existing issues: GitHub Issues
-
Create a new issue: Include:
-
grai.build version (
grai --version
) - Python version (
python --version
) - Operating system
- Full error message
- Relevant YAML files
-
Steps to reproduce
-
Enable debug mode:
- Check logs:
Useful Debug Commands¶
# Check grai installation
which grai
grai --version
# Validate YAML syntax
python -c "import yaml; yaml.safe_load(open('entities/customer.yml'))"
# List all entities and relations
grep "^entity:" entities/*.yml
grep "^relation:" relations/*.yml
# Test Neo4j connection
cypher-shell -a bolt://localhost:7687 -u neo4j -p password "RETURN 1 as test"
# Check compiled Cypher
cat target/neo4j/compiled.cypher | head -50
# Run with verbose output
grai build --verbose
grai load --verbose --limit 10
# Export current schema
grai export --format json --output debug-schema.json