plugins/midnight-tooling/skills/midnight-debugging/SKILL.md
--- name: midnight-tooling:midnight-debugging description: Use when encountering Midnight errors like "compact: command not found", "ERR_UNSUPPORTED_DIR_IMPORT", version mismatches, proof server failures, "@midnight-ntwrk" package errors, or compilation failures. --- # Midnight Environment Debugging Expert knowledge for identifying and resolving common Midnight development toolchain issues. ## Diagnostic Approach When encountering Midnight-related errors, follow this systematic approach: 1.
npx skillsauth add aaronbassett/midnight-knowledgebase plugins/midnight-tooling/skills/midnight-debuggingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert knowledge for identifying and resolving common Midnight development toolchain issues.
When encountering Midnight-related errors, follow this systematic approach:
/midnight:sync-releases if version info needed/midnight:doctor for comprehensive checks/midnight:check to confirmFor comprehensive diagnostics:
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/doctor.py
Symptom: compact: command not found
Diagnosis:
# Check if compact exists somewhere
ls -la ~/.compact/bin/compact 2>/dev/null || echo "Not in default location"
# Check PATH
echo $PATH | tr ':' '\n' | grep -i compact
Solutions:
| Cause | Fix |
|-------|-----|
| Not installed | Run Compact installer (see midnight-setup skill) |
| Not in PATH | Add export PATH="$HOME/.compact/bin:$PATH" to shell profile |
| Wrong shell profile | Edit ~/.zshrc (macOS) or ~/.bashrc (Linux) |
| Profile not sourced | Open a new terminal window |
Symptoms:
pragma language_version mismatchesDiagnosis:
# Check current versions
compact compile --version
npm list @midnight-ntwrk/compact-runtime
npm list @midnight-ntwrk/ledger
Key Rule: All Midnight components must use compatible versions per the support matrix.
Solutions:
Check the compatibility matrix in cached release notes or run /midnight:versions
Use exact versions in package.json (no ^ or ~):
{
"dependencies": {
"@midnight-ntwrk/compact-runtime": "0.9.0",
"@midnight-ntwrk/ledger": "4.0.0"
}
}
Clean install after version changes:
rm -rf node_modules package-lock.json
npm ci
Recompile contracts after compiler update:
rm -rf contract/*.cjs contract/*.prover contract/*.verifier
compact compile src/contract.compact contract/
See references/version-mismatch-guide.md for detailed version troubleshooting.
Symptom: ERR_UNSUPPORTED_DIR_IMPORT
Causes:
Solutions:
Open a new terminal window (not just source profile)
Clear module cache:
rm -rf node_modules/.cache
Verify correct Node version:
node --version # Should be 18+
nvm use 18 # If using nvm
Reinstall node_modules:
rm -rf node_modules
npm install
Symptoms:
Diagnosis:
# Check if running
docker ps | grep proof-server
# Check if port is available
lsof -i :6300
# Check Docker is running
docker info
Solutions:
| Issue | Fix |
|-------|-----|
| Not running | docker run -p 6300:6300 midnightnetwork/proof-server -- midnight-proof-server --network testnet |
| Port in use | Stop other process: kill $(lsof -t -i:6300) or use different port |
| Docker not running | Start Docker Desktop |
| Image not pulled | docker pull midnightnetwork/proof-server:latest |
| Wrong network | Ensure --network testnet matches your target |
Symptoms:
Diagnosis:
# Check compiler version matches pragma
compact compile --version
# In contract file, check pragma:
# pragma language_version 0.18;
Common Issues:
| Error | Cause | Fix | |-------|-------|-----| | Pragma mismatch | Contract declares different version | Update pragma or switch compiler version | | Type errors | Language feature changed | Check release notes for breaking changes | | Circuit too large | Complex computation | Simplify logic or split into multiple transactions |
Symptoms:
npm install fails for @midnight-ntwrk packagesSolutions:
Check npm registry access:
npm view @midnight-ntwrk/compact-runtime
Clear npm cache:
npm cache clean --force
Use exact versions to avoid peer conflicts
Don't mix lockfiles - use only package-lock.json (npm) OR bun.lock (Bun)
| Check | Command |
|-------|---------|
| All tool versions | /midnight:check |
| Comprehensive diagnostic | /midnight:doctor |
| Current vs latest versions | /midnight:versions |
| Component changelog | /midnight:changelog compact |
See references/common-errors.md for a complete catalog of error messages and their solutions.
If standard troubleshooting doesn't resolve the issue:
tools
Use when setting up Midnight development environment, installing Compact compiler and developer tools, configuring proof server, verifying prerequisites, or getting started with Midnight development.
tools
Use when checking Midnight version compatibility, understanding pragma language_version, verifying compiler and runtime version relationships, or troubleshooting version mismatch errors between Midnight components.
tools
Use when setting up CI/CD for Midnight projects, configuring GitHub Actions for Compact contract compilation, running TypeScript tests in CI, validating version consistency, or automating contract builds.
tools
Use when managing deployed contract lifecycles, inspecting contract state, backing up state before upgrades, planning contract migrations, implementing versioning strategies, or deprecating contracts gracefully.