Troubleshooting
Common Issues & Solutions
Connection Issues
Cannot Connect to Database
Error: Error: Cannot connect to database
Solutions:
Verify credentials
bash# Check default-env.json exists and is valid JSON cat default-env.json | jq '.' # Or check environment variables echo $HANA_HOST $HANA_PORT $HANA_USERTest network connectivity
bash# Windows ping hana.example.com # Linux/Mac ping -c 3 hana.example.comVerify port is correct
- Standard SQL port: 30013 (or 30015 for cloud)
- Check with HANA administrators
Check firewall
- Ensure port is open to your machine
- Test with telnet:
telnet hana.example.com 30013
Connection Timeout
Error: Error: Connection timeout after 30000ms
Solutions:
Check network connectivity
- Ping HANA server
- Check for firewall rules
- Verify proxy settings if behind corporate proxy
Increase timeout
bashexport HANA_CONNECTION_TIMEOUT=60000 # 60 seconds hana-cli dbInfoCheck HANA service is running
- Contact HANA administrator
- Verify service status on HANA web console
SSL Certificate Error
Error: Error: self signed certificate
Solutions:
For development only (use CA certificate for production):
bashexport HANA_SSL_VERIFY=false hana-cli dbInfoUse certificate file
bashexport HANA_SSL_CERT=/path/to/certificate.pem hana-cli dbInfo
Command Execution Issues
Command Not Found
Error: hana-cli: command not found
Solutions:
Reinstall globally
bashnpm install -g hana-cli --forceCheck npm prefix
bashnpm config get prefix # Add this directory to PATHVerify installation
bashnpm list -g hana-cli
Permission Denied
Error: EACCES: permission denied
Solutions:
Linux/Mac - Fix npm permissions
bashmkdir ~/.npm-global npm config set prefix '~/.npm-global' export PATH=~/.npm-global/bin:$PATH npm install -g hana-cliWindows - Run as Administrator
- Right-click PowerShell/CMD → Run as Administrator
Use sudo (not recommended)
bashsudo npm install -g hana-cli
Insufficient Privileges
Error: Error: Insufficient privileges for operation
Solutions:
Check user permissions
- User must have SELECT privilege on tables
- For admin operations, use --admin flag
Use admin credentials
bashhana-cli schemaClone -s SOURCE -t TARGET --adminRequest permissions from DBA
- Contact SAP HANA administrator
- Ask for specific schema/table privileges
Data Import Issues
File Not Found
Error: Error: File not found: data.csv
Solutions:
Use absolute path
bashhana-cli import -n /full/path/to/data.csv -t TABLECheck file exists
bash# Windows dir data.csv # Linux/Mac ls -la data.csvCheck working directory
bash# Show current directory pwd # Linux/Mac cd # Windows
CSV Encoding Issues
Error: Error: Invalid character encoding
Solutions:
# Specify encoding
hana-cli import -n data.csv -t TABLE --encoding utf-8
# Convert file encoding
iconv -f ISO-8859-1 -t UTF-8 input.csv > output.csv
hana-cli import -n output.csv -t TABLEColumn Mismatch
Error: Error: Column mismatch at row X
Solutions:
Use name matching
bashhana-cli import -n data.csv -t TABLE -m nameCheck column names
bashhana-cli tables -s SCHEMA -t TABLEPrepare data file
- Ensure headers match table columns
- Use --truncate if starting fresh
Output & Format Issues
Output Format Error
Error: Error: Invalid output format
Solutions:
# Use supported formats
hana-cli export -s SCHEMA -t TABLE --output json
hana-cli export -s SCHEMA -t TABLE --output csv
hana-cli export -s SCHEMA -t TABLE --output textLarge Export Timeout
Error: Error: Operation timeout - export too large
Solutions:
Export in batches
bash# Limit rows hana-cli export -s SCHEMA -t TABLE --limit 10000 -o part1.csvUse pagination
bash# Export first 1000 rows hana-cli export -s SCHEMA -t TABLE --offset 0 --limit 1000 # Export next 1000 rows hana-cli export -s SCHEMA -t TABLE --offset 1000 --limit 1000Filter data
bashhana-cli export -s SCHEMA -t TABLE -w "STATUS='ACTIVE'" -o active.csv
Performance Issues
Slow Command Execution
Solutions:
Enable debug to see timing
bashhana-cli dataProfile -s SCHEMA -t TABLE --debugCheck table size
bashhana-cli dbInfo -t TABLEUse limit for large tables
bashhana-cli export -s SCHEMA -t TABLE --limit 1000
High Memory Usage
Solutions:
Process in chunks
bashhana-cli export -s SCHEMA -t TABLE --batch-size 500Increase Node.js heap
bashnode --max-old-space-size=4096 $(which hana-cli) export ...
Language & Localization
Wrong Language Output
Solutions:
# Set language
export HANA_LANG=en
hana-cli dbInfo
# Or per command
HANA_LANG=de hana-cli dbInfoGetting Help
Check Documentation
Command help
bashhana-cli <command> --helpSearch documentation
Knowledge base
bashhana-cli kb search "your topic"
Enable Debug Output
hana-cli <command> --debug --verboseCheck Logs
# Set log level
export HANA_LOG_LEVEL=debug
# View logs
cat $HANA_LOG_FILEReport Issues
- GitHub Issues
- Include: error message, command executed, environment details
Tips & Tricks
Test Your Connection
# Simple connectivity test
hana-cli dbInfo
# More detailed diagnostics
hana-cli dbInfo --debugDry Run
# Most write operations support --dry-run
hana-cli import -n data.csv -t TABLE --dry-runBatch Operations Script
#!/bin/bash
set -e # Exit on error
for file in data/*.csv; do
echo "Processing $file..."
hana-cli import -n "$file" -t TABLE || echo "Failed: $file"
done