Troubleshooting
A collection of common issues and fast, actionable fixes when working with Amp. Each section includes the cause and the steps to resolve it.
Incorrect Dataset Reference: “Unknown dataset reference ’_/counter@latest’”
Section titled “Incorrect Dataset Reference: “Unknown dataset reference ’_/counter@latest’””Cause: Local development datasets require the @dev and not @latest.
# Incorrectpnpm amp query 'SELECT * FROM "_/counter".incremented'
# Correctpnpm amp query 'SELECT * FROM "_/counter@dev".incremented'Notes:
@devidentifies unpublished local datasets. Published datasets use explicit versions (for example,@1.0.0) or@latest.
Empty Tables
Section titled “Empty Tables”Cause: No events have been generated yet.
Fix:
- Open http://localhost:5173.
- Click increment or decrement.
- Wait a few seconds for new blocks.
- Run your query again.
Verify events exist:
# Check if any events have been emittedpnpm amp query 'SELECT COUNT(*) FROM "_/counter@dev".incremented'Config Changes Not Applying
Section titled “Config Changes Not Applying”Cause: Amp caches dataset configurations and must be restarted.
Fix:
just down # Stop all services and clean volumesjust up # Restart infrastructure and redeployDataset Not Deploying
Section titled “Dataset Not Deploying”Symptoms:
“dataset not found”- Missing directory under
infra/amp/data/ - Build succeeds but no tables appear
Debug Steps:
- Check logs
docker compose -f infra/docker-compose.yaml logs amp | grep counter- Verify data directory
ls -la infra/amp/data/You should see a counter/ directory.
- Deploy manually
pnpm ampctl dataset deploy _/counter@dev- Validate configuration
pnpm amp build -o /tmp/test-manifest.jsonCommon Causes:
- SQL syntax errors
- Violations of streaming model rules
- Services not fully started (wait for just up to complete)
- Local Anvil connectivity issues
Build Errors
Section titled “Build Errors”“non-incremental operation: Limit”
Section titled ““non-incremental operation: Limit””Cause: LIMIT is not allowed in derived table definitions.
Fix: Use filters in table definitions and apply LIMIT only during queries.
// Invalidsql: `SELECT * FROM anvil.blocks LIMIT 100`
// Validsql: `SELECT * FROM anvil.blocks WHERE _block_num > 100`Query:
pnpm amp query 'SELECT * FROM "_/counter@dev".all_blocks LIMIT 100'“non-incremental operation: Order”
Section titled ““non-incremental operation: Order””Remove ORDER BY from table definitions. Use it only at query time.
pnpm amp query 'SELECT * FROM "_/counter@dev".incremented ORDER BY block_num DESC'“non-incremental operation: Aggregate”
Section titled ““non-incremental operation: Aggregate””Aggregations (GROUP BY, COUNT, SUM) are not allowed in table definitions.
Use them during queries:
pnpm amp query ' SELECT block_num, COUNT(*) AS event_count FROM "_/counter@dev".incremented GROUP BY block_num'“invalid value ‘dev’ for ‘—tag’”
Section titled ““invalid value ‘dev’ for ‘—tag’””Cause: Using -t dev.
Fix: Use the dataset tag inside the reference:
# Incorrectpnpm amp query -t dev 'SELECT * FROM "_/counter".incremented'
# Correctpnpm amp query 'SELECT * FROM "_/counter@dev".incremented'Services Not Starting
Section titled “Services Not Starting”Symptoms: Hanging just up, crashing containers, port conflicts.
Fixes:
- Check Docker:
docker ps- Check port conflicts:
lsof -i :5432lsof -i :8545lsof -i :1602- Stop conflicting services:
brew services stop postgresqlkillall anvil- Reset Docker state:
just downdocker system prune -fjust up- Verify toolchain versions:
node --versionpnpm --versiondocker --versionforge --versionjust --versionamp --versionQuery Timeouts
Section titled “Query Timeouts”Cause: Large result sets or complex joins.
Fixes:
- Add
LIMIT:
pnpm amp query 'SELECT * FROM anvil.blocks LIMIT 100'- Filter by indexed columns:
pnpm amp query ' SELECT * FROM anvil.logs WHERE address = '\''0x...'\'' LIMIT 10'- Create pre-filtered derived tables:
sql: `SELECT * FROM anvil.logs WHERE address = '0x...'`- Check service health:
docker compose -f infra/docker-compose.yaml psdocker compose -f infra/docker-compose.yaml logs ampFrontend Not Connecting
Section titled “Frontend Not Connecting”Symptoms: Data not loading, network errors, “Failed to fetch.”
Fixes:
- Ensure dev server is running:
just dev- Verify app/.env:
cat app/.env- Confirm dataset deployment:
pnpm amp query 'SELECT COUNT(*) FROM "_/counter@dev".incremented'- Inspect browser console.
Advanced Debugging
Section titled “Advanced Debugging”Connect to PostgreSQL
Section titled “Connect to PostgreSQL”open http://localhost:7402
docker exec -it amp-postgres psql -U postgres -d ampUseful queries:
SELECT * FROM datasets;SELECT name, status, error FROM datasets WHERE name = 'counter';View Detailed Logs
Section titled “View Detailed Logs”just logsdocker compose -f infra/docker-compose.yaml logs -f ampdocker compose -f infra/docker-compose.yaml logs amp | grep ERRORReset System State
Section titled “Reset System State”just downrm -rf infra/amp/data/rm -rf infra/amp/datasets/just upTest Anvil Connectivity
Section titled “Test Anvil Connectivity”curl -X POST http://localhost:8545 \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'Validate Dataset Build
Section titled “Validate Dataset Build”pnpm amp build -o /tmp/manifest.jsoncat /tmp/manifest.json | jqCommon Error Messages
Section titled “Common Error Messages”“table does not exist”
- Confirm table exists in amp.config.ts.
- Restart services: just down && just up.
- Verify dataset reference includes tag.
“column does not exist”
pnpm amp query 'DESCRIBE "_/counter@dev".incremented'Check naming and case sensitivity.
“parse error”
- Validate SQL syntax.
- Ensure dataset references are quoted.
- Validate escaping.
“cannot read properties of undefined” (FE runtime error)
- Log data to ensure response exists.
- Gate UI logic on presence of data.
Performance Issues
Section titled “Performance Issues”Slow Queries
- Filter datasets.
- Use EXPLAIN:
pnpm amp query 'EXPLAIN SELECT * FROM anvil.blocks'- Limit data by block range.
High Memory Usage
- Reduce result size.
- Split large tables into focused tables.
- Restart services (
just down && just up).