Troubleshooting & Diagnostics Guide
Resolve common installation issues, authentication errors, approval lifecycle mismatches, framework adapter behaviors, and build-time filesystem quirks safely and predictably.
SDK Installation & Python Environment Issues
Root Cause: You are installing or executing with Python ≤ 3.11. SICTACK specifies requires-python = ">=3.12" in pyproject.toml.
Fix: Upgrade your runtime environment to Python 3.12 or newer. Verify your active version with python --version.
Root Cause: The SDK package is not installed in the active virtual environment.
Fix: Install in editable mode from your local checkout:
pip install -e /path/to/SICTACK_SDK/sdk/pythonRoot Cause: Import Shadowing. A file or directory in your current working directory is named sictack.py or sictack/, intercepting the real package.
# How import shadowing occurs
# If your project directory contains a file named 'sictack.py'':
import sictack # Fails or loads the empty local file instead of the package!
# Solution:
# 1. Rename any local script named sictack.py to test_agent.py or run_defense.py
# 2. Check the resolved module path:
python -c "import sictack; print(sictack.__file__)"
# Correct output: .../site-packages/sictack/__init__.pyWindows OneDrive EPERM -4048 Build Lock
When building Next.js projects inside a folder synced by Microsoft OneDrive on Windows, the build may halt with:Error: EPERM: operation not permitted, rmdir '...\frontend\.next\build\chunks'
Why This Happens
Microsoft OneDrive continuously monitors directory changes in synchronized folders. When Next.js compiles chunks, OneDrive locks subdirectories (such as .next/build/chunks) to calculate file hashes and sync status, setting Windows file attributes (ReparsePoint and ReadOnly). Node.js fs.rmdirSync cannot unlink active OneDrive reparse points while the sync client holds an open lock.
Safe Remediation (Do NOT Unsafely Delete User Files)
- Pause OneDrive Sync During Builds: Right-click the OneDrive cloud icon in the Windows taskbar and select “Pause syncing → 2 hours” before running production builds.
- Exclude .next from Cloud Sync: Ensure
.nextis included in your project root.gitignore. In Windows PowerShell, clear readonly flags if locked:PowerShell# Check file attributes in PowerShell without deleting files: Get-Item -Path "frontend\.next\build\chunks" | Format-List Attributes # Safe workaround: Point Next.js build cache to a local directory outside OneDrive sync: # In next.config.ts: # distDir: process.env.NEXT_DIST_DIR || '.next' - Build Outside Synced Directory: In CI/CD or production environments, clone repositories into local directories outside cloud storage sync roots (e.g.
C:\dev\sictackor Linux containers).
Authentication & API Key Issues
Check: API keys must be passed in the header X-API-Key: ilk_live_... (or Authorization: Bearer <key>).
Confirm your key starts with ilk_live_ or ilk_test_. If revoked, generate a replacement in the SOC dashboard.
Check: Operator JWT tokens have a 24-hour expiration window (ACCESS_TOKEN_EXPIRE_MINUTES=1440). Re-authenticate via POST /api/v1/auth/login to obtain a fresh token.
Permission Denials & Policy Debugging
When a tool call returns DENY, inspect the reason string in the Decision object:
| Reason Code | Trigger Condition | How to Resolve |
|---|---|---|
| TOOL_NOT_REGISTERED | The agent attempted to invoke a tool name not present in the registry. | Register the callable via agent.register_tool() or check tool name spelling. |
| PERMISSION_DENIED | The tool's required permission is present in denied_permissions or missing from allowed_permissions. | Update the policy in the dashboard or pass an updated Policy definition. |
| SENSITIVITY_TOO_HIGH | Tool sensitivity exceeds policy max_sensitivity. | Lower tool sensitivity or increase policy ceiling for authorized agents. |
| RECIPIENT_NOT_ALLOWED | Target recipient email domain does not match allowed_recipients pattern. | Add the authorized domain pattern (e.g. *@partner.com) to the policy. |
| POLICY_MISSING_FAIL_CLOSED | No active policy found for tenant or registered agent. | Create an organization default policy via POST /api/v1/policies. |
Approval Expiration & Replay Errors
The approval ticket exceeded its TTL (default 300s). The agent must re-request the operation to generate a new pending ticket.
The payload arguments executed by the agent differ from what the human operator approved. Check for modified variables or dynamic timestamps.
The approval ticket has already been consumed. Approvals are strictly single-use nonces; subsequent calls require new tickets.
Backend Connectivity & Database Errors
Symptom: The first request to the backend after 15 minutes of inactivity takes 30–50 seconds to respond.
Explanation: Free Render web services spin down on idle. In your client, configure a higher initial timeout (timeout=60.0) or upgrade to an always-on instance for production workloads.
Symptom: PostgreSQL connection pool exhaustion on Supabase.
Fix: Switch your connection string from direct port 5432 to the Supabase Transaction Pooler port 6543. Ensure your URL includes ?sslmode=require.
Missing Organization Context
In multi-tenant operations, requests without a resolved organization context fall back to the default organization. When explicitly required by strict endpoints:
- Pass header:
X-Organization-ID: your-org-slug. - Or ensure your operator JWT token was minted with the
org_idclaim.
Framework Adapter Issues (LangChain, LangGraph, MCP)
LangChain: Tool Error Propagation
By default, SecureTool sets handle_tool_error=True. Instead of crashing your agent, security denials are caught and formatted as text for the LLM. If your application code needs typed exceptions, set it to False:
# LangChain Adapter: Distinguishing Tool Error Handling
from sictack.integrations.langchain import SecureTool
# Default behavior: handle_tool_error=True
# Returns string to LLM: "[SECURITY_ERROR: PermissionDeniedError] Action 'db_drop' denied"
safe_tool = SecureTool(tool=my_tool, agent=agent, handle_tool_error=True)
# Strict exception mode: handle_tool_error=False
# Raises PermissionDeniedError or ApprovalRequiredError directly to calling code
strict_tool = SecureTool(tool=my_tool, agent=agent, handle_tool_error=False)LangGraph: Missing Approval Exception
In LangGraph, SecureGraphNode does not raise ApprovalRequiredError. Instead, it captures the requirement and branches state by returning {"_sictack_status": "REQUIRE_APPROVAL", "_approval_id": "..."} (alongside legacy _intentlock_status). Verify that your graph includes a conditional edge routing this state to an approval node.
Model Context Protocol: JSON-RPC Code -32603
When MCPSecurityProxy intercepts a disallowed tool call, it responds with a standard JSON-RPC 2.0 error object. Inspect the error.data._sictack dictionary (or legacy _intentlock) in client responses to view full verdict reasons.
Quick Diagnostics Matrix
| Error Code / Exception | Primary Cause | Immediate Diagnostic Action |
|---|---|---|
| 401 Unauthorized | Invalid or missing API key / JWT | Check X-API-Key or re-login for new JWT. |
| 403 Forbidden | Role insufficient or unapproved token | Check user role (ADMIN vs VIEWER). |
| 409 Conflict | Approval token already consumed (replay) | Request a new approval ticket for subsequent execution. |
| 410 Gone | Approval token expired (TTL exceeded) | Increase timeout or approve before expiration window. |
| EPERM -4048 | OneDrive lock on .next/build/chunks | Pause OneDrive sync or build in unsynced directory. |