Troubleshooting
Common issues and their solutions when working with Moose.
Development Environment
Issue: moose dev fails to start
Possible causes and solutions:
-
Port conflicts
- Check if ports 4000-4002 are already in use
- Solution: Kill the conflicting processes or configure different ports
# Find processes using ports lsof -i :4000-4002 # Kill process by PID kill <PID>Configuration Override: You can also change the ports Moose uses via environment variables:
export MOOSE_HTTP_PORT=4040 export MOOSE_MANAGEMENT_PORT=5010 moose dev -
Missing dependencies
- Solution: Ensure all dependencies are installed
npm install -
Docker not running
- Solution: Start Docker Desktop or Docker daemon
# Check Docker status docker info # Start Docker on Linux sudo systemctl start docker -
Container Startup Failures
- Check if specific containers failed to start.
- Solution: View container logs to debug service-specific issues.
# View logs moose logs
Data Ingestion
Issue: Data not appearing in tables
-
Validation errors
- Check logs for validation failures
- Solution: Ensure data matches schema
moose logs -
Stream processing errors
- Solution: Check transform functions for errors
moose logs --filter functions -
Database connectivity
- Solution: Verify database credentials in
.moose/config.toml
- Solution: Verify database credentials in
[clickhouse_config]db_name = "local"user = "panda"password = "pandapass"use_ssl = falsehost = "localhost"host_port = 18123native_port = 9000Stream Processing
Issue: High processing latency
-
Insufficient parallelism
- Solution: Increase stream parallelism
const stream = new Stream<Data>("high_volume", { parallelism: 8 // Increase from default});
Issue: Data transformations not working
-
Transform function errors
- Solution: Debug transformation logic
// Add logging to transformstream.addTransform(outputStream, (record) => { console.log('Processing record:', record.id); try { // Your transformation logic return transformedRecord; } catch (error) { console.error('Transform error:', error); return undefined; // Skip record on error }});
Database Issues
Issue: Slow queries
-
Missing or improper indexes
- Solution: Check orderByFields configuration
const table = new OlapTable<Data>("slow_table", { orderByFields: ["frequently_queried_field", "timestamp"]}); -
Large result sets
- Solution: Add limits and pagination
// In query APIconst results = await client.query.execute(sql` SELECT * FROM large_table WHERE category = 'example' LIMIT 100`);
Deployment Issues
Issue: Deployment fails
-
Configuration errors
- Solution: Check deployment configuration
# Validate configuration moose validate --config -
Resource limitations
- Solution: Increase resource allocation
# In kubernetes manifestresources: requests: memory: "1Gi" cpu: "500m" limits: memory: "2Gi" cpu: "1000m" -
Permission issues
- Solution: Verify service account permissions
# Check permissions moose auth check
Issue: Migration stuck with "Migration already in progress"
Cause: A previous migration was interrupted without releasing its lock.
Solution:
-
Wait 5 minutes - locks expire automatically
-
Or manually clear the lock:
DELETE FROM _MOOSE_STATE WHERE key = 'migration_lock'; -
Verify it worked:
SELECT * FROM _MOOSE_STATE WHERE key = 'migration_lock';-- Should return no rows
MooseTip:
The _MOOSE_STATE table uses ClickHouse's KeeperMap engine for distributed locking, ensuring only one migration runs at a time across multiple deployments.
Getting Help
If you can't resolve an issue:
- Ask for help on the Moose community Slack channel
- Search existing GitHub issues
- Open a new issue with:
- Moose version (
moose --version) - Error messages and logs
- Steps to reproduce
- Expected vs. actual behavior
- Moose version (