5.0 KiB
Debugging Playbook
Standardized troubleshooting steps for common issues in the AITBC system.
CLI Command Fails with Import Error
Symptoms
ModuleNotFoundError: No module named 'trading_surveillance'
or similar when running aitbc <command>.
Checklist
- ✅ CLI venv has required packages:
numpy,pandas,aiohttp,fastapi,uvicornpip list | grep -E "numpy|pandas|aiohttp|fastapi|uvicorn" - ✅
pyproject.tomlincludes these dependencies under[tool.poetry.dependencies]or equivalent. - ✅ Service modules are reachable via PYTHONPATH. CLI command modules prepend the service path at runtime.
- ✅ No name shadowing in the command file (imported functions aliased if needed).
Fix
- Install missing packages into CLI venv.
- Update
pyproject.tomland reinstall. - If shadowing, rename imports with
_svcsuffix.
Brother Chain Node Stuck at Height 0
Symptoms
- Health returns
200, butgetBlockshows no blocks after genesis - Mint transactions not confirmed
Checklist
- ✅
.envconfiguration matches the intended chain ID and ports - ✅ Node started with
PYTHONPATHincludingapps/blockchain-node/src - ✅ Proposer is configured:
PROPOSER_IDandPROPOSER_KEYset- In the consensus configuration, the proposer is listed as an authority
- ✅ Check node logs for messages about "proposer" and "authority"
- ✅ Verify RPC
syncStatusreports progress
Fix
- If proposer not set, either set it in
.envand restart, or manually create a block via RPC (if supported). - Ensure the genesis file includes the proposer in the authority set.
- Check that the P2P node is running and not failing to accept connections.
Regulatory Command Crashes with slice(None, 1, None)
Symptom
Running aitbc regulatory test or aitbc regulatory generate-sar produces:
KeyError: slice(None, 1, None)
Cause
Name shadowing: the command function generate_sar overwrote the imported service function generate_sar. When the code tried to call generate_sar(...), it actually called the Click command object (which is subscriptable in a weird way), leading to the KeyError.
Fix
In cli/aitbc_cli/commands/regulatory.py:
- Import as:
from regulatory_reporting import generate_sar as generate_sar_svc - Replace all calls to
generate_sar(...)withgenerate_sar_svc(...) - Also fix
generate_compliance_summary→generate_compliance_summary_svcandlist_reports→list_reports_svc
Reference: See ai-memory/bug-patterns.md for full pattern.
Gitea API Returns Empty or 403
Symptoms
curlto/api/v1/repos/...returns[]or403- Expected data not visible
Checklist
- ✅ Token has
reposcope (full control of private repositories) - ✅ Token user is a collaborator with Write permission on the repository
- ✅ Using correct
GITEA_API_BASEandGITEA_REPO - ✅ Token is correctly exported:
export GITEA_TOKEN=... - ✅ User identity matches collaborator entry (
aitbcoraitbc1)
Fix
- Generate a new token with sufficient scopes in Gitea (Settings → Applications)
- Ensure the user is added as collaborator with Write access (Repository → Settings → Collaborators)
PR Merge Blocked by Branch Protection
Symptoms
- Merge button disabled in web UI
- API merge returns error about required approvals or status checks
Checklist
- ✅ PR has at least one approval from the other agent
- ✅ All required status checks are
success(e.g.,aitbc/local-validation) - ✅ Branch is up-to-date with
main(no conflicts) - ✅ The reviewing agent's approval is from a different user than the author
Fix
- Address any failing checks.
- Request review from the sibling agent and wait for approval.
- Rebase if necessary to resolve conflicts.
Lost Work Due to Duplicate Claims
Symptom Two agents started work on the same issue independently.
Prevention Always use the claim branch pattern before starting:
git checkout -b claim/<issue-number>
git push origin claim/<issue-number> || exit 1 # fails if already claimed
If push fails, another agent claimed it; pick a different issue.
Auto-Review Script Fails to Checkout PR
Symptoms
auto_review.py logs "Failed to checkout PR#..."
Checklist
- ✅ Token has
reposcope to read PR branches - ✅ The branch exists on remote (
git ls-remote origin <branch>) - ✅
.gitdirectory exists and credentials are set for origin - ✅ Workdir cleanup on previous failures
Fix
- Ensure proper token.
- Manually verify branch exists:
git ls-remote --heads origin aitbc/... - Increase log verbosity to capture errors.
Memory Layer Usage
Before attempting a fix, consult:
ai-memory/bug-patterns.mdfor known patternsai-memory/architecture.mdfor module responsibilitiesai-memory/debugging-playbook.mdfor systematic troubleshootingai-memory/failure-archive/for past failed approaches
End of playbook.