Troubleshooting Guide¶
Quick-reference for common Crucible issues. Symptom → Cause → Fix. See also: CLI Reference, Simple Operations, Maintenance Guide
Quick Reference — At a Glance¶
| Symptom | Most Likely Cause | First Action |
|---|---|---|
anvil not found on PATH |
Foundry not installed locally | Run foundryup |
Connection refused on 127.0.0.1:8547 |
Stale meta file in states/ volume |
rm -f states/*.meta.json |
chain bsc did not become ready within 30s |
RPC env var empty or unreachable | Check echo $BSC_RPC_URL |
experiment failed then unhelpful traceback |
Multiple possible causes | Check run.jsonl first |
sh -c fails with invalid choice: 'sh' |
Entrypoint is crucible, not a shell | Use --entrypoint bash |
evidence.yaml missing sections |
Attack pack scaffold incomplete | Run crucible plugin validate |
reproduction fidelity invalid |
L0-L4 level mis-spelled in evidence.yaml | Check acceptance.fidelity field |
port 8545 already in use |
Previous Anvil not cleaned up | crucible clean --all |
ConfigError: YAML file not found |
Missing testbed.yaml |
crucible init or create from template |
Fidelity violation |
Runtime behavior doesn't match declared level | Check enforcer output for specifics |
Transaction reverted without error |
Wrong calldata, address, or preconditions | cast call with --trace to see revert reason |
crucible: command not found |
Environment not activated or uv sync not run |
uv sync && source .venv/bin/activate (Linux) or .venv\Scripts\activate (Windows) |
1. Docker Issues¶
Docker: Entrypoint Validation¶
$ docker compose run --rm orchestrator sh -c "uv run crucible doctor"
Fails with: crucible: error: argument command: invalid choice: 'sh'
Cause: The orchestrator's entrypoint is [\"uv\", \"run\", \"crucible\"], not a shell. sh -c passes sh as a subcommand to crucible.
Fix: Override the entrypoint with --entrypoint bash:
docker compose run --rm --entrypoint bash orchestrator -c "
uv run crucible doctor && \
uv run crucible plugin list
"
Tip: For single commands, you don't need --entrypoint bash:
# This works fine:
uv run crucible doctor
uv run crucible plugin validate attacks/demo_attack
# Only needed when chaining:
docker compose run --rm --entrypoint bash orchestrator -c "cmd1 && cmd2"
Orchestration: Stale State Metadata¶
Cause: The states/ Docker volume persists .meta.json files from previous forks. When you switch topologies, stale meta files reference chains and ports that aren't running.
Fix: Always clean stale meta files before forking:
rm -f states/*.meta.json
# Or inside Docker:
rm -f states/*.meta.json && uv run crucible fork --topology single
Prevention: Add the cleanup to your run script or use crucible clean --states which also handles this.
Execution: Port Allocation Conflict¶
Error: error: EOF: Anvil failed to start
# or
Error: error binding to 127.0.0.1:8545: address already in use
Cause:
- A previous Anvil instance is still running
- Another process (e.g., another Crucible, a manual anvil) occupies the port
Fix:
# Stop all Crucible chains
crucible clean
# In Docker:
docker compose down
# Check what's on the port (Windows):
netstat -ano | findstr :8545
# Then taskkill /PID <pid> /F
Caching: Bind-Mount Permission Denied¶
# Blank fork inside Docker fails with Connection refused
# BUT same config works on the host machine
Cause: The orchestrator container bind-mounts the host's .fork_cache/ directory
(.:/workspace). If the host has stale cache data from a previous archive fork
(e.g., .fork_cache/ethereum/latest/ with different chain ID or block), Anvil running
inside the container reads that stale cache and crashes on init.
This is a common failure mode when switching between archive forks and blank forks inside Docker — the cache directory persists on the host but the container's Anvil doesn't expect it.
Diagnose:
# Inside the container, check if stale cache exists
docker compose run --rm --entrypoint bash orchestrator -c "
ls -la .fork_cache/ethereum/latest/ 2>/dev/null || echo 'No stale cache'
"
Fix:
# Clean cache from the host (affects the container via bind-mount)
rm -rf .fork_cache/*
# Or clean inside the container:
docker compose run --rm --entrypoint bash orchestrator -c "rm -rf .fork_cache/*"
Prevention:
- Always clean .fork_cache/ before switching between archive and blank forks
- Add the cache cleanup to your smoke test scripts (see RELEASE_CHECKLIST.md §4)
Docker: Image Compilation Failure¶
$ docker compose build orchestrator
...
Error: error loading environment variables from .env: file not found
Cause: Missing .env file. The Dockerfile references env vars from .env.
Fix:
Docker: Daemon Connectivity Failure¶
Fix:
# Start Docker Desktop
Start-Process "C:\Program Files\Docker\Docker\Docker Desktop.exe"
# Wait for it to be ready (10-30s)
docker ps
# If it doesn't start, check:
# - Windows WSL2 is installed
# - Virtualization is enabled in BIOS
# - Docker Desktop has permission in Windows Security
2. Foundry Issues¶
Dependencies: Foundry Executables Not Found¶
Inside Docker: Foundry should be pre-installed. If missing, rebuild:
If the Dockerfile's foundryup step failed, check build logs:
Locally (Windows):
# Install Foundry (one-time)
cd ~
curl -L https://foundry.paradigm.xyz -o foundryup.bat
.\foundryup.bat
foundryup
# If foundryup fails, install via uv or pip:
uv tool install foundry-devops
# Or download binaries from https://github.com/foundry-rs/foundry/releases
Verify installation:
Dependencies: Foundry Version Incompatibility¶
Cause: The testbed.yaml foundry.required_version doesn't match the installed version.
Fix:
# Option A: Update the config to match your version
foundry:
required_version: "" # skip version check
skip_version_check: true
# Option B: Pin to a specific version
foundry:
required_version: "2025-03-01" # nightly date format
Orchestration: Anvil Initialization Failure¶
Cause 1 — Not an archive node: The RPC provider doesn't serve historical state at the requested block.
Cause 2 — Fork block too old: The provider only keeps recent history (~128 blocks for public nodes).
Fix: - Check the provider's archive depth (see RPC Provider Guide) - Switch to a paid archive provider (GetBlock, QuickNode) for BSC/Polygon - For Ethereum, LlamaNodes works for all attack fork blocks
Test archive depth:
curl -s -X POST -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["0x94E334",false]}' \
https://your-rpc-provider
# Returns block data if archive, error if not
3. RPC Issues¶
Configuration: Missing Environment Variables¶
Cause: ${BSC_RPC_URL} is referenced in testbed.yaml but not defined in .env.
Fix:
# Check what's set:
docker compose run --rm --entrypoint bash orchestrator -c 'echo "BSC=$BSC_RPC_URL"'
# Add to .env if missing:
echo 'BSC_RPC_URL=https://go.getblock.io/YOUR_TOKEN' >> .env
Orchestration: RPC Readiness Timeout¶
Cause 1 — RPC URL unreachable: The upstream RPC endpoint is down, slow, or the env var is empty.
Fix: Test connectivity:
docker compose run --rm --entrypoint bash orchestrator -c '
curl -s --max-time 10 -X POST -H "Content-Type: application/json" \
-d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_blockNumber\",\"params\":[]}" \
https://go.getblock.io/YOUR_TOKEN
'
Cause 2 — Provider rate limiting: The free tier is rate-limited, causing timeouts during history fetching.
Fix: Add fallback providers in testbed.yaml:
rpc_providers:
bsc:
- name: primary
url: "${BSC_RPC_URL}"
- name: publicnode
url: "https://bsc.publicnode.com"
priority: 2
Crucible automatically retries with the next provider on failure.
Cause 3 — Fork block too deep: Provider doesn't archive that far back.
Fix: Use a paid archive provider (GetBlock, QuickNode). See RPC Provider Guide.
Cause 4 — Stale fork cache (blank forks only): Even on blank forks (fork_block: null),
Anvil uses --cache-path .fork_cache/<chain>/latest to cache genesis state. If that cache
directory has stale data from a previous archive fork (different chain ID, block, or RPC
provider), Anvil may fail to initialize and crash silently — producing the same
Connection refused timeout.
This can happen when switching from archive forks to blank forks or between different archive forks on the same chain.
Diagnose:
# Check if cache directory exists from a previous run
ls -la .fork_cache/ethereum/latest/ 2>/dev/null && echo "Stale cache detected"
# If it contains data from a different block/provider, that's the issue
Fix:
Prevention:
- Always clean .fork_cache/ before switching between archive forks and blank forks
- Add rm -rf .fork_cache/* to your CI/automation scripts before forking
- See Blank Fork Failure Recovery for detailed recovery
RPC: Provider Rate Limiting (HTTP 429)¶
Free tier limits vary by provider:
| Provider | Limit | Action |
|---|---|---|
| LlamaNodes | 25 req/s | Usually sufficient; add fallback |
| PublicNode | 10 req/s | Single-chain only, add fallback |
| Ankr (no key) | ~15 req/s | Free tier may hit limits |
Fix: Add multiple providers as fallbacks. Crucible rotates through them:
rpc_providers:
ethereum:
- name: primary
url: "${ETH_RPC_URL}"
- name: llamarpc
url: "https://eth.llamarpc.com"
priority: 2
- name: publicnode
url: "https://ethereum.publicnode.com"
priority: 3
RPC: Historical State Not Available¶
Cause: The RPC endpoint is a full node, not an archive node. It does not store historical state data required for forking.
Resolution: Switch to an archive-capable provider (e.g., GetBlock, QuickNode, Alchemy) that guarantees access to the specific historical block.
RPC: anvil_setBalance or eth_sendTransaction Fails on New Address¶
RPC error for anvil_setBalance: failed to get account for 0xDeaDDeaD...:
server returned an error response: error code -32000:
state 0x34f7657d... is not available
Cause: Crucible instantiates Anvil with --accounts 0 --balance 0. When funding a new (non-existent) address via anvil_setBalance or sending a transaction from it, Anvil attempts to verify the address in the remote archive. If the archive node has pruned its state trie for addresses that did not exist at the fork block (common with free Polygon/BSC endpoints), the remote lookup fails.
Resolution: 1. Fallback Provider: Configure a premium archive provider (e.g., GetBlock) capable of serving the complete state trie. 2. Graceful Degradation: The core bridge plugins are designed to gracefully skip chains if state retrieval fails. 3. Use Existing Addresses: For custom research, impersonate an address that already possesses a recorded state at the target block rather than generating novel EOAs.
RPC: Manual Archive Depth Verification¶
To definitively verify a provider's true archive depth directly from the orchestrator environment:
uv run crucible doctor # Internal verification
# Direct CURL verification against the provider:
export HEX_BLOCK=0xE8DB9C # e.g., Ethereum 15,259,100
export RPC_URL="https://your-provider-url"
# Test 1: Block Header Availability
curl -s --max-time 10 -X POST -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["'$HEX_BLOCK'",false]}' \
"$RPC_URL"
# Test 2: Historical Balance Retrieval
curl -s --max-time 10 -X POST -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getBalance","params":["0x0000000000000000000000000000000000000000","'$HEX_BLOCK'"]}' \
"$RPC_URL"
# Test 3: Historical Bytecode Retrieval
curl -s --max-time 10 -X POST -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getCode","params":["0x838bf9E95CB12Dd76a54C9f9D2E3082EAF928270","'$HEX_BLOCK'"]}' \
"$RPC_URL"
If Test 1 succeeds but Tests 2 or 3 fail, the provider is serving cached headers but lacks true archive state.
4. Instrumentation & Artifact Issues¶
Empty Artifact Streams (No Events or Storage Diffs Captured)¶
Cause: The instrumentation proxy captures events and storage diffs via debug_traceTransaction on the forked Anvil. Certain Anvil nightly builds may fail silently on the prestateTracer + diffMode combination, producing 0 events and 0 storage diffs even though the exploit transaction succeeded.
How to confirm: Gas is still captured (from eth_getTransactionReceipt), and balance diffs may also be captured. Check:
cat logs/<experiment>/<run_id>/chain_ethereum/gas_profile.jsonl
cat logs/<experiment>/<run_id>/chain_ethereum/balance_diffs.jsonl
If gas is present but events/storage are empty, the proxy hit the trace fallback.
New behavior: Crucible now logs a prominent failure step when debug_traceTransaction fails, showing:
[FAIL] trace failed for tx 0xabc... — storage diffs + balance changes lost. Gas + events captured from receipt.
See TROUBLESHOOTING.md for Anvil version advice.
Fix (manual recovery):
# 1. Get the tx hash from gas_profile.jsonl
# 2. Use cast to fetch the receipt manually (events live here)
cast receipt <tx_hash> --rpc-url http://127.0.0.1:8545
# 3. Check if debug_traceTransaction works directly
cast rpc debug_traceTransaction <tx_hash> \
'{"tracer": "prestateTracer", "tracerConfig": {"diffMode": true}}' \
--rpc-url http://127.0.0.1:8545
# 4. If the direct call works but the proxy didn't capture it,
# this is a proxy bug worth reporting. If it also fails,
# it's an Anvil version limitation.
Workaround: The attack plugin's verify() method reads storage independently via RPC — check run.jsonl for pass/fail assertions. A passed verification means the exploit worked, even if the artifact streams are incomplete.
Prevention: Pin your Foundry version to a known-good stable release (not nightly) if complete artifact capture is required for publication:
Experiment Fails With Unhelpful Traceback¶
First: Check the run log, not the traceback. The run.jsonl file contains all lifecycle events:
# If you have a run directory:
cat logs/demo_experiment/*/run.jsonl | tail -20
# Inside Docker:
docker compose run --rm --entrypoint bash orchestrator -c '
cat logs/demo_experiment/*/run.jsonl | tail -20
'
Each line shows phase, action, status, and message — look for "status":"failure".
Baseline Mismatch¶
Cause: The chain state at fork block doesn't match the captured baseline (e.g., different block, different provider).
Fix: 1. Don't overwrite the baseline immediately. 2. Understand WHY the state changed — different RPC provider? Different fork block? Different topology? 3. If the change is intentional (e.g., new experiment), delete the old baseline and capture a new one:
Fork Block Wrong for Experiment¶
Cause: The testbed.yaml fork_block is set for a different experiment, OR the evidence.yaml doesn't specify the correct fork block.
Auto-fix: Since Crucible now auto-merges fork_block from evidence.yaml at runtime, most cases are handled automatically. Check the experiment output for:
If auto-merge doesn't fix it:
- Verify evidence.yaml has historical_scope.fork_blocks.ethereum set to the correct block
- Or manually override with testbed.local.yaml:
To bypass auto-merge entirely: use --no-auto-merge:
evidence.yaml specifies a different one. Useful when testing against a specific block without auto-override.
Fork block reference:
| Attack | Ethereum | Polygon | BSC |
|---|---|---|---|
| Nomad Bridge | 15,259,100 | — | — |
| Wormhole Guardian | 14,125,553 | — | — |
| Poly Network | 12,996,693 | 16,332,982 | 9,755,172 |
| Horizon Multisig | 15,005,526 | — | — |
| BNB Token Hub | — | — | 22,166,659 |
| Multichain Router | 16,329,241 | — | — |
Contract Address Wrong (EOA Instead of Contract)¶
Cause: The contract address in the attack pack is actually an EOA (user wallet), not a contract. This was the most common bug found during validation (3 out of 13 bugs).
Fix:
1. Paste the address into Etherscan
2. Verify the page shows "Contract" (not "Address (EOA)")
3. Update the address in the attack pack's plugin.py and evidence.yaml
Fidelity Violation¶
ERROR:crucible.experiment:Fidelity violation: Fidelity level L2 requires fork-state execution evidence
Cause: The experiment's runtime behavior doesn't match the fidelity level declared in the attack plugin's evidence.yaml. For example, an attack claiming L3 (exact transaction replay) but not producing transaction artifacts.
Fix:
- Check the enforcer error message for the specific unmet requirement
- Either adjust the attack to meet the requirement (e.g., add exact_tx_replay) or
- Lower the declared fidelity level in evidence.yaml
- Use --no-fidelity to skip fidelity checks entirely (useful for demo/simulation experiments)
See the Fidelity Enforcement section in CLI Reference for per-level requirements.
Bridge Deployment — Double 0x Prefix¶
Cause: Foundry's compiled bytecode.object already includes the 0x hex prefix. The bridge plugin's deploy method prepends another "0x" + bytecode, producing "0x0x6080..." which Anvil rejects.
Fix:
# Double prefix:
"data": "0x" + bytecode, # "0x0x6080..."
# Correct:
"data": bytecode, # bytecode from Foundry already has "0x"
Prevention: All 3 bridge plugins (nomad_bridge, poly_network_bridge, wormhole_bridge) have been fixed. If creating a new bridge plugin, use bytecode directly without prepending "0x".
Bridge Deployment — Archive Can't Serve State (Polygon/BSC)¶
RPC error for anvil_setBalance: failed to get account for 0xDeaDDeaD...: historical state ... is not available
Cause: Some archive nodes (especially Polygon and BSC) don't serve full historical state at older fork blocks. When anvil_setBalance is called on a new (non-existent) address, Anvil tries to look it up in the remote archive and the archive returns "state not available".
Fix: This is handled gracefully in all 3 bridge plugins — the offending chain is skipped with a warning and the experiment continues on other chains. If you need the bridge deployed on all chains: - Use a different RPC provider with better archive depth (see RPC Provider Guide) - Use a more recent fork block - Run with a topology that doesn't include the problematic chain
Prevention: All bridge plugins now wrap per-chain deployment in try/except, so one chain's failure doesn't crash the whole experiment.
Auto-Merge Kills Chain But Never Restarts It¶
ERROR: Experiment failed: Connection refused on http://127.0.0.1:8545
# After a message: fork_block updated from X to Y (from evidence.yaml)
Cause: The auto-merge feature correctly reads fork_blocks from evidence.yaml and terminates the old Anvil. But if the chain isn't restarted at the new block, any subsequent RPC calls fail with "Connection refused".
Fix (already applied): This was a framework bug in crucible/experiment.py — the chain is now automatically re-forked after auto-merge terminates the old process.
Workaround (if still happening): Use --no-auto-merge to bypass auto-merge entirely:
Bridge evidence.yaml Uses Placeholder String¶
ERROR: Evidence validation against live chain failed:
- Contract "deployed by bridge plugin" has no code on any running chain
Cause: The evidence.yaml affected_contracts section has a placeholder string instead of a real contract address (e.g., NomadReplica: "deployed by bridge plugin"). The evidence pre-flight validation tries to call get_code() on that string, which fails.
Fix:
# Placeholder string:
affected_contracts:
NomadReplica: "deployed by bridge plugin"
# Empty list for dynamically deployed contracts:
affected_contracts: [] # contracts deployed at runtime by bridge plugin
Checkpoint Tries To Snapshot Dead Chains¶
Cause: The checkpoint manager iterates over all .meta.json files in states/. If a stale meta file exists (from a previous topology with different chains), it tries to snapshot a chain that's no longer running.
Fix: Framework fix — checkpoint now filters to only snapshot chains in the active topology. Use rm -f states/*.meta.json before switching topologies to clean up stale files.
set_balance Fails On Precompile Address¶
RPC error for anvil_setBalance: failed to get account for 0x0000000000000000000000000000000000000001
Cause: Address 0x...0001 is the ECDSA-recover precompile. Anvil has special handling for precompile addresses and anvil_setBalance may fail on them, especially on forked chains.
Fix: Use a random EOA address (e.g., 0xDeaDDeaDDeaDDeaDDeaDDeaDDeaDDeaDDeaDDeaD) that has no special meaning on any chain:
# Precompile address:
self._deployer = "0x0000000000000000000000000000000000000001"
# Random EOA:
self._deployer = "0xDeaDDeaDDeaDDeaDDeaDDeaDDeaDDeaDDeaDDeaD"
Port TIME_WAIT After Killing Anvil¶
Error: error binding to 127.0.0.1:8545: address already in use
# After auto-merge message about updating fork_block
Cause: After SIGTERM/SIGKILL, the OS keeps the port in TIME_WAIT state (30-120 seconds). When auto-merge tries to start a new Anvil immediately on the same port, it fails.
Fix: Framework fix — Crucible now polls the port every 500ms for up to 10 seconds before starting the new Anvil. If the port is still busy, a warning is printed but the experiment continues.
Demo/Agent Experiments Require LLM API Key¶
Cause: The experiment uses an AgentPlugin (LLM-driven attack) configured with agent_provider: openai but no API key is set.
Fix: Use the mock provider to run agent experiments without any LLM:
# experiments/demo_agent.yaml
run:
agent_provider: mock # instead of "openai" or "ollama"
agent_model: mock
Experiment Hangs / Never Completes¶
Possible causes:
- RPC provider is slow to respond (check rate limits)
- Anvil is still syncing historical state (check docker compose logs anvil-ethereum)
- The attack plugin has an infinite loop
Diagnose:
# Check if Anvil is alive:
curl -s -X POST -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' \
http://127.0.0.1:8545
# Check Docker logs:
docker compose logs anvil-ethereum --tail=20
# Check if the attack is making progress:
docker compose logs orchestrator --tail=20
5. Plugin Issues¶
Plugin Not Found¶
Common causes:
- Plugin directory doesn't exist: attacks/my_cool_attack/
- Wrong plugin type: --type bridge when the plugin is an attack
- Missing plugin.yaml in the plugin directory
Fix:
# List all discovered plugins:
crucible plugin list
# Validate a specific plugin for detailed errors:
crucible plugin validate attacks/my_cool_attack
Missing plugin.yaml¶
Fix: The plugin directory must contain plugin.yaml. Generate a scaffold:
crucible attack init my_cool_attack
# Creates attacks/my_cool_attack/ with plugin.yaml, evidence.yaml, and plugin.py
Missing Evidence Sections¶
PluginInvalid: evidence.yaml missing sections: incident, sources, historical_scope, reproduction_scope, acceptance
Cause: The evidence.yaml file is incomplete. Required sections for attack plugins:
- incident (name, date, description)
- sources (at least one source URL)
- historical_scope (how many transactions/blocks)
- reproduction_scope (chains, fidelity level)
- acceptance (required_assertions)
Fix: Look at a complete example:
Bridge Evidence Missing¶
Cause: Bridge plugins also require evidence.yaml, but with different sections:
- protocol (name, version)
- features (list of modeled features)
- limitations (list of known limitations)
- chains (optional — list of supported chains)
Fix: See the demo bridge for a complete example:
Entry File Not Found¶
Cause: The plugin.yaml references an entry file that doesn't exist.
Fix:
# plugin.yaml — make sure the entry field matches the actual filename:
name: my_cool_attack
type: attack
version: "1.0.0"
entry: plugin.py # ← must match the .py file on disk
class: MyCoolAttackPlugin
Class Doesn't Implement Expected Interface¶
Cause: The plugin class doesn't inherit from the correct base class.
Fix:
# Attack plugins must inherit from AttackPlugin:
from crucible.sdk import AttackPlugin
class MyCoolAttackPlugin(AttackPlugin): # ← correct
...
# Bridge plugins must inherit from BridgePlugin:
from crucible.sdk import BridgePlugin
class MyCoolBridgePlugin(BridgePlugin): # ← correct
...
6. Configuration Issues¶
Missing testbed.yaml¶
Fix:
# The file should be in the project root. If missing:
copy testbed.yaml.example testbed.yaml
# or on Linux/macOS:
cp testbed.yaml.example testbed.yaml
Duplicate Port or Chain ID¶
ValueError: chains ethereum and polygon share port 8545
# or
ValueError: chains bsc and polygon share chain_id 100
Cause: Two chains in testbed.yaml have the same port or chain_id.
Fix: Assign unique ports and chain IDs:
chains:
ethereum:
port: 8545
chain_id: 1
polygon:
port: 8546 # was 8545 — conflict resolved
chain_id: 137 # was 100 — use real chain ID
Config Parse Errors¶
Cause: YAML structure doesn't match the expected schema (e.g., wrong field name, wrong type).
Fix: Check the error message for the specific field, then validate:
7. Local Environment & Setup Issues¶
uv sync Fails¶
Cause: Python version mismatch — Crucible requires Python 3.11+.
Fix:
# Check your Python version
python3 --version
# Install Python 3.12 on Ubuntu:
sudo apt-get install -y python3.12 python3.12-venv
# Use the correct Python:
uv python pin 3.12
uv sync
uv Command Not Found¶
Fix:
# Install uv via pip (recommended):
pip install uv
# Or via the standalone installer:
curl -LsSf https://astral.sh/uv/install.sh | sh
# Or install Crucible without uv (system-wide):
pip3 install --break-system-packages -e ".[dev,analysis,ui,jupyter]"
crucible: command not found After Activating Venv¶
# First check if venv is active:
which python # should point to .venv/bin/python
# If not, activate it:
source .venv/bin/activate # Linux/macOS
.venv\Scripts\activate # Windows
# If still not found, reinstall:
uv sync
.venv Permission Denied / Can't Remove¶
error: failed to remove directory `.venv/lib': Permission denied (os error 13)
# When running: uv run pytest or uv sync
Cause: The .venv directory was created by a different user (e.g., root during
Docker setup or an earlier build). The current user can read and execute files inside
but cannot modify or delete them. uv tries to recreate the venv when packages change
and fails because it can't remove the root-owned directory.
Check ownership:
Fix (without sudo):
# Use Docker to remove root-owned .venv (runs as root inside container):
docker compose run --rm --entrypoint bash orchestrator -c "rm -rf /workspace/.venv"
# Then recreate with current user's permissions:
uv sync
The Docker container runs as root and can remove files owned by any user when they're bind-mounted into the container.
Alternative fix (with sudo):
Prevention: Always create the .venv with your own user (uv sync without sudo).
If the venv was created inside a Docker container that ran as root, it will be
root-owned on the host — recreate it with uv sync after removal.
ModuleNotFoundError: No module named 'crucible'¶
Cause: The package hasn't been installed in editable mode, or the venv was created but uv sync hasn't run.
Fix:
# Make sure you're in the project root
cd /path/to/crucible_testbed
# Install the package
uv sync
# Or if not using uv:
pip install -e .
Foundry Not Installed Locally¶
Fix:
# One-time install
curl -L https://foundry.paradigm.xyz | bash
source ~/.bashrc
foundryup
# Verify:
anvil --version
forge --version
cast --version
Port Conflict When Running Locally¶
Cause: A previous Crucible run or manual anvil instance is still running.
Fix:
# Stop all Crucible chains
crucible clean
# Force-kill any orphaned anvil processes
pkill -f anvil 2>/dev/null || true
# Check what's using the port
lsof -i :8545
# Kill: kill -9 <PID>
--break-system-packages Warning¶
Cause: PEP 668 prevents installing Python packages outside a venv.
Fix: Either use a venv (uv sync && source .venv/bin/activate) or bypass on dedicated machines:
--break-system-packages flag is safe on machines dedicated to the testbed where you don't need environment isolation.
crucible doctor Shows Failing Checks¶
Common failing checks and their solutions:
| Check | Fails | Fix |
|---|---|---|
foundry binary: anvil |
not found on PATH |
Install Foundry or use Docker |
config: testbed.yaml |
file not found |
Create from template |
rpc: ethereum |
not resolved |
Set ETH_RPC_URL in .env |
.env file |
not found |
cp .env.example .env |
required dirs |
not found |
crucible init |
port 8545 |
already in use |
Kill process or change port |
Docker |
not available |
Only matters for Docker mode |
streamlit |
not available |
Only matters for dashboard; install via uv sync --extra ui |
# Targeted checks:
crucible doctor --python --foundry # Python + Foundry only
crucible doctor --ports # Port availability
crucible doctor --fix # Auto-fix broken symlinks + missing dirs
Ports Already In Use (Windows)¶
# Find what's using port 8545:
netstat -ano | findstr :8545
# Output: TCP 127.0.0.1:8545 0.0.0.0:0 LISTENING 12345
# Kill the process:
taskkill /PID 12345 /F
# If it's WSL-bound:
wsl --shutdown
Permission Denied (Windows Docker)¶
Fix:
1. Ensure Docker Desktop is running (check system tray)
2. Run PowerShell as Administrator
3. If running in WSL2, ensure your user is in the docker group:
7B. Orphaned Processes & Port Recovery¶
Zombie (Defunct) Anvil Processes¶
Cause: A zombie (defunct) process has exited but hasn't been reaped by its parent. Zombies can't receive signals (SIGKILL has no effect) and don't hold ports, but they clutter the process table.
How to detect:
ps aux | grep defunct | grep anvil
# Example output:
# testbed 2006869 0.0 0.0 0 0 pts/3 Z+ 14:20 0:00 [anvil] <defunct>
# The "Z" state flag means zombie
How Crucible handles it: Crucible's ChainManager.process_is_zombie() reads /proc/<pid>/status for State: Z on Linux. When detected, the process is treated as already terminated — no signals are sent.
Manual cleanup: Zombies are reaped by their parent when it calls wait(). If the parent is already dead, init (PID 1) will eventually reap them. They don't block new forks.
Orphaned Anvil & Crucible Fork Process Trees¶
Cause: Each uv run crucible fork --topology <name> command spawns a process tree:
uv run crucible fork --topology <name>
└── crucible fork --topology <name>
└── anvil --port 8545 ...
uv run is killed (timeout, crash, Ctrl+C), the child crucible fork and its anvil children may survive as orphans, still holding their ports.
How to detect:
# Find all crucible fork + anvil processes
ps aux | grep -E '(anvil|crucible fork)' | grep -v grep
# Check which ports are occupied
ss -tlnp | grep -E '854[5-8]'
Complete cleanup:
# Kill ALL at once
pkill -9 -f 'anvil'
pkill -9 -f 'crucible fork'
sleep 2
# Remove stale meta files
rm -f states/*.meta.json
# Verify all ports are free
ss -tlnp | grep -E '854[5-8]' || echo 'All free'
Port Keeps Getting Reoccupied After Kill¶
Symptom: You kill the anvil process on port 8545, verify it's free, but when you run crucible fork again, the port is already occupied.
Root cause: One of:
1. Process tree — Killing the child anvil doesn't kill the parent crucible fork, which may be restarting it
2. TIME_WAIT — The port is in TIME_WAIT state (30-120s) after the process exits
3. Another crucible fork command — A previous uv run crucible fork from a subagent call is still running
Step-by-step recovery:
# Step 1: Find exactly what's on the port
fuser -v 8545/tcp
# Shows PID, user, and command
# Step 2: Trace the parent chain
ps -o pid,ppid,args -p <PID>
# If the parent is `crucible fork`, kill the parent too
# Step 3: Kill the entire process tree
# Kill the leaf process first, then the parent
kill -9 <anvil_PID>
kill -9 <crucible_fork_PID>
# Step 4: Or nuke everything at once (faster)
pkill -9 -f 'anvil'
pkill -9 -f 'crucible fork'
sleep 3
rm -f states/*.meta.json
# Step 5: Verify truly free
ss -tlnp | grep 8545 || echo 'Free'
Prevention:
- Use a consistent port configuration and don't switch between runs
- Run crucible clean --all between experiments
- In CI/automation, clean stale meta files before forking
- If using subagents to run fork commands, add a cleanup step after
Tmux Sessions Managing Anvil¶
Cause: An anvil process may be running inside a tmux session. Killing it from outside the session won't stop the tmux-managed process.
Check:
Fix: Kill the tmux session or switch to its pane and stop the process.
7C. Blank Fork Failure Recovery¶
Chain Never Becomes Ready on Blank Fork (No Archive)¶
ERROR: chain ethereum did not become ready within 300s on http://127.0.0.1:8545:
Connection refused
# BUT you set fork_block: null — no remote RPC should be needed
Symptom: The fork command hangs for 300s and eventually times out with Connection refused, even though you configured a blank fork (fork_block: null) with no RPC dependency.
Root cause: Anvil crashed silently on startup. Despite being a blank fork (no --fork-url flag, no archive fetch needed), anvil can fail to start for these reasons:
-
--accounts 0 --balance 0conflict — Anvil nightly builds may reject--accounts 0combined with--balance 0on blank forks. The process exits immediately with exit code 0 and no stderr output. Crucible uses these flags to avoid prefetching default accounts from remote archives; on blank forks this is unnecessary but usually harmless. -
Stale fork cache — If
.fork_cache/ethereum/latest/has stale data from a previous archive fork (different chain ID or block), anvil may fail when initializing the cache for the blank fork. The cache path--cache-path .fork_cache/ethereum/latestis used even for blank forks. -
Port occupied by orphan — A previous orphan anvil process still holds the port (see Orphaned Processes & Port Recovery).
-
Stale fork process — A previous
uv run crucible forkcommand may still be alive. Check withps aux | grep 'crucible fork'.
How to distinguish from archive fork failure:
- You configured fork_block: null — no remote RPC should be needed
- The error tends to appear quickly (not a slow 300s timeout waiting for RPC)
- There's no --fork-url in the anvil command line (check logs/anvil/<chain>.log header)
- crucible status shows no running chain even though you just forked
Diagnose:
# 1. First thing: check the anvil log for crash details
cat logs/anvil/ethereum.log
# Empty log → anvil never started (crashed on init)
# Has eth_blockNumber requests → anvil IS running, check port/process
# 2. Check if anvil is actually in the process table
ps aux | grep anvil | grep -v grep
# [anvil] <defunct> → zombie (dead, harmless)
# Live anvil but not responding → check log for errors
# 3. Check if the port is actually free
ss -tlnp | grep 8545
# 4. Try starting anvil manually to see the error
test_port=8550 # Different port to avoid conflict
anvil --host 127.0.0.1 --port $test_port --chain-id 1 --gas-price 0 \
--block-base-fee-per-gas 1000000000 --auto-impersonate --order fifo \
--accounts 0 --balance 0 2>&1 | head -20
# If anvil exits silently → --accounts 0 bug
# Try without --accounts 0 --balance 0:
anvil --host 127.0.0.1 --port $test_port --chain-id 1 --auto-impersonate 2>&1 | head -10
Fix:
# 1. Clean up stale caches
rm -rf .fork_cache/ethereum/latest .fork_cache/polygon/latest
# 2. Kill ALL orphaned processes
pkill -9 -f 'anvil' 2>/dev/null
pkill -9 -f 'crucible fork' 2>/dev/null
sleep 2
# 3. Remove stale meta files
rm -f states/*.meta.json
# 4. Verify ports are truly free
ss -tlnp | grep -E '854[5-8]' || echo 'All free'
# 5. Retry the blank fork
crucible fork --topology nomad_bridge
# If STILL failing, start anvil directly:
anvil --host 127.0.0.1 --port 8545 --chain-id 1 --auto-impersonate &
sleep 2
curl -s -X POST -H 'Content-Type: application/json' \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
http://127.0.0.1:8545
Prevention:
- Always clean cache before switching from archive forks to blank forks
- Always kill orphaned processes before starting a new fork
- The --accounts 0 --balance 0 issue is an Anvil nightly quirk — update Foundry or use a stable release
8. Diagnostic Commands — Quick Reference¶
First: Run These¶
# 1. Full environment check:
crucible doctor
# 2. List running chains:
crucible status
# 3. List plugins:
crucible plugin list
# 4. Validate config:
python -c "from crucible.config import load_config; load_config(); print('OK')"
When an Experiment Fails¶
# 1. Check the run log:
cat logs/<experiment>/*/run.jsonl | grep failure
# 2. Validate evidence:
crucible plugin validate attacks/<attack_name>
# 3. Check integrity:
crucible verify logs/<experiment>/<run_id>
# 4. Compare with a known-good run:
crucible diff <failed_run> <known_good_run>
When Docker Doesn't Work¶
# Check container status:
docker compose ps
# View orchestrator logs:
docker compose logs orchestrator --tail=30
# View Anvil logs:
docker compose logs anvil-ethereum --tail=30
# Test RPC connectivity:
docker compose run --rm --entrypoint bash orchestrator -c '
curl -s --max-time 10 -X POST -H "Content-Type: application/json" \
-d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_blockNumber\",\"params\":[]}" \
http://anvil-ethereum:8545
'
# Full reset:
docker compose down -v
docker compose build --no-cache orchestrator
Check Disk Usage¶
9. Error Codes & Exception Hierarchy¶
Crucible defines a typed exception hierarchy for programmatic error handling. Each exception carries both a message and an exit code.
Exit Code Reference¶
| Exit Code | Python Exception | Meaning | Common Cause |
|---|---|---|---|
| 0 | — | Success | — |
| 1 | CrucibleError |
General failure | Experiment crashed, unknown error |
| 2 | ConfigError |
Config invalid | Bad YAML, wrong field types |
| 3 | BaselineMismatch |
Baseline mismatch | State changed, different provider/block |
| 4 | — | Command failed | Subprocess returned non-zero |
| 5 | EnvironmentError |
Environment invalid | Missing Foundry, Python version |
| 6 | RpcError |
RPC unavailable | Empty env var, provider down |
| 7 | AssertionFailed |
Assertion failed | Attack plugin's verify() returned False |
| 8 | PluginInvalid |
Plugin invalid | Bad manifest, missing class |
| 9 | PublicationGateFailed |
Publication gate failed | Evidence/baseline/provenance incomplete |
| 10 | EvidenceIncomplete |
Evidence incomplete | Missing required evidence sections |
| 11 | ProvenanceIncomplete |
Provenance incomplete | Git commit, config fingerprint missing |
| 130 | — | Interrupted | Ctrl+C or SIGINT |
Exception Hierarchy¶
CrucibleError (base, exit_code=1)
├── ConfigError (exit_code=2)
│ └── Raised when: YAML parse error, validation error, missing file
├── BaselineMismatch (exit_code=3)
│ └── Raised when: Baseline file hash doesn't match, live state differs from baseline
├── EnvironmentError (exit_code=5)
│ └── Raised when: anvil not on PATH, Python too old, port in use
├── RpcError (exit_code=6)
│ └── Raised when: RPC provider unreachable, rate limited, connection timeout
├── AssertionFailed (exit_code=7)
│ └── Raised when: Attack plugin's verify() returns False, scenario assert fails
├── PluginInvalid (exit_code=8)
│ └── Raised when: Missing plugin.yaml, wrong class, bad manifest
├── PublicationGateFailed (exit_code=9)
│ └── Raised when: --publication-mode gate checks fail (fidelity, baseline, provenance)
├── EvidenceIncomplete (exit_code=10)
│ └── Raised when: evidence.yaml missing required sections
└── ProvenanceIncomplete (exit_code=11)
└── Raised when: Git commit not available, config fingerprint incomplete
When to Catch Specific Exceptions¶
from crucible.errors import (
CrucibleError, ConfigError, BaselineMismatch, RpcError,
AssertionFailed, PluginInvalid, EvidenceIncomplete,
)
# Example: Gracefully handle a missing RPC provider
try:
chain_manager.start_topology(topo)
except RpcError as exc:
print(f"RPC provider unavailable: {exc}")
# Fall back to blank fork or use a different provider
# Example: Catch and log baseline mismatches
try:
baselines.verify("my_scenario")
except BaselineMismatch as exc:
print(f"Baseline changed — recapture: {exc}")
baselines.capture("my_scenario", topo)
Still stuck? Check the detailed guide for your scenario: - User Guide — Getting started - Operations Runbook — Daily ops - CLI Reference — All flags - RPC Provider Guide — Provider setup - Reproducibility Guide — Determinism checks - Deployment Guide — SSH deployment
10. LLM Agents¶
LLM Agents: API Key Unconfigured¶
Symptom: Operations terminate immediately with OpenAI API key not set or Anthropic API key not set.
Cause: Required provider authentication keys are missing from the environment scope.
Solution:
- Define OPENAI_API_KEY or ANTHROPIC_API_KEY inside .env.
- Alternatively, assign agent_provider: ollama in the configuration for unauthenticated local execution.
LLM Agents: Plugin Resolution Failure¶
Symptom: Log emits Agent plugin 'xyz' not found.
Cause: The target plugin plugin.yaml lacks the required type: classification or the path does not exist.
Solution:
- Explicitly declare type: agent within the plugin definition file.
LLM Agents: Infinite Evaluation Loops¶
Symptom: Agent repeatedly evaluates the state loop without making material progress towards the objective.
Cause: The specified target model lacks sufficient parameter capabilities, or the agent_objective is inadequately defined.
Solution:
- Transition to a more capable model architecture (e.g., gpt-4o, claude-sonnet-4-20250514).
- Strictly constrain instructions within the objective declaration.
- Decrease agent_temperature to values between 0.1-0.3 to mandate deterministic operational sequences.
LLM Agents: Strict Budget Termination¶
Symptom: The execution loop aborts abruptly, raising budget_exceeded.
Cause: Cumulative token consumption exceeded the agent_llm_budget restriction prior to objective completion.
Solution:
- Expand the agent_llm_budget value within the run configuration.
- Alternatively, remove the parameter entirely for unconstrained execution.
LLM Agents: Ollama Connection Refused¶
Symptom: Initial provider ping fails with can't connect to localhost:11434.
Cause: The local Ollama daemon is offline or operating on a differing port binding.
Solution:
- Execute ollama serve and ensure the target model is cached locally via ollama pull llama3.1.
- For remote inference servers, explicitly define agent_base_url: http://<remote-ip>:11434/v1 within the experiment YAML.
LLM Agents: Ollama Null Tool Execution¶
Symptom: Ollama providers consistently generate empty or malformed tool call structures.
Cause: The localized model does not inherently support strict function calling capabilities.
Solution:
- Standardize on models strictly tuned for structured extraction (e.g., llama3.1:70b, mistral:7b, qwen2.5:7b).
LLM Agents: Llama-Server Architecture Segmentation Fault¶
Symptom: The inference process terminates with llama-server process has terminated: signal: segmentation fault.
Cause: Underlying compatibility failure between llama.cpp CPU implementations and older generation processor architectures (e.g., early Intel Xeon instances).
Solution:
- Manually upgrade the localized Ollama binary to the current stable build.
- Substitute the model request for smaller memory footprints (e.g., qwen2:0.5b).
- Force thread constraint by appending num_threads: 2 to the generation options.
- If persistent hardware failures remain, delegate evaluation to an external provider (e.g., OpenAI or Anthropic).
LLM Agents: Configuration Parameter Ignored¶
Symptom: Experiment CLI initializes successfully but does not bind standard agent configurations.
Cause: agent_provider was not strictly initialized within the YAML run: block.
Solution:
- Provide standard agent mappings (e.g., agent_provider: ollama) natively within the run: segment.
LLM Agents: Objective Deviation¶
Symptom: The autonomous loop aggressively ignores primary objective targets.
Cause: Prompt engineering failure; instructions lack deterministic constraints.
Solution:
- Formalize concrete, sequence-bound steps. Evaluate attacks/llm_exploit_agent/llm_exploit_agent.py as a reference architecture for rigid operational definitions.