Errors & Scenarios
Every common error with its exact fix, four complete end-to-end setup scenarios, and a quick reference cheatsheet for minimal .env configurations.
1. Startup / Configuration Errors
These errors are raised before the server accepts any requests. They mean a required environment variable or config file is missing. Fix them in .env or config.ini and restart the server.
EnvironmentError: OPENAI_API_KEY is not setAdd OPENAI_API_KEY=sk-your-key to your .env file and restart. Or set it as a shell variable: export OPENAI_API_KEY=sk-...
EnvironmentError: core.storage = s3 but the following are missing: AWS_OUTPUT_BUCKET, AWS_CONFIG_BUCKETSet AWS_OUTPUT_BUCKET and AWS_CONFIG_BUCKET in .env. Also set AWS credentials (AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY), AWS_PROFILE, or use an IAM role.
EnvironmentError: chatbot_PDF_PATH is not set (pdf_filler=mapper requires a PDF path)Set chatbot_PDF_PATH=./data/input/blank_form.pdf in .env. Drop your blank PDF at that path first.
EnvironmentError: pdf_filler.provider = managed but these .env keys are missing: AUTH0_DOMAIN, AUTH0_CLIENT_ID, ...Set all 6 managed mode variables: AUTH0_DOMAIN, AUTH0_CLIENT_ID, AUTH0_CLIENT_SECRET, AUTH0_AUDIENCE, FILL_PDF_LAMBDA_URL, PDF_API_KEY.
2. Import / Module Errors
These errors occur when a required Python package is not installed, or when running from a repo clone without setting PYTHONPATH.
ModuleNotFoundError: No module named 'fastapi'Run: pip install -r requirements-api.txt Or: pip install fastapi uvicorn python-multipart
ModuleNotFoundError: No module named 'chatbot'If pip-installed: run pdf-autofillr status to check the install. If from repo clone: run export PYTHONPATH=$(pwd)/src from the repo root before starting any command.
ModuleNotFoundError: No module named 'boto3'Run: pip install boto3 Or: pip install -r requirements-s3.txt
ImportError: pdf-autofiller-sdk is required for mapper modeInstall the mapper SDK: pip install -r requirements-mapper.txt Or: pip install -e ../mapper/sdks/python/
ImportError: chatbot-managed package required for managed PDF modeThe chatbot-managed package is not open source. Contact your Autofiller account team for access. As an alternative, switch to mapper mode (chatbot_PDF_FILLER=mapper) or data-only mode.
3. API / Runtime Errors
These errors are returned as HTTP responses during normal server operation.
HTTP 400: missing user_id or session_idBoth user_id and session_id are required fields in every POST /chatbot/chat request. Both must be non-empty strings.
HTTP 404 on /mapper/fill (mapper returns 404)MAPPER_URL_PREFIX is wrong. Use /mapper when running mapper's api_server.py (default). Use an empty string when running mapper's bare fastapi_app.py directly.
HTTP 429: rate limit exceededThe messages_per_session, sessions_per_user_per_day, or llm_calls_per_session limit was hit. Raise the limits using RateLimitConfig in code, or switch to the Redis backend for accurate distributed counting.
HTTP 500: internal server errorCheck the server logs for the full traceback. Most common causes: LLM extraction failure (check OPENAI_API_KEY is valid), storage write failure (check disk permissions or S3 credentials), config file missing or malformed JSON.
HTTP 404: session not found (GET /chatbot/session/{uid}/{sid})The session is not complete yet - filled_data is only available after session_complete = true in the chat response. Only call GET /session after session_complete appears in the POST /chatbot/chat response.
4. Config File Errors
FileNotFoundError: Required config file not found: configs/form_keys.jsonRun: pdf-autofillr setup This creates configs/form_keys.json and all required config files. Then restart the server.
Investor type not loading correct mandatory fieldsInvestor type names in mandatory.json must exactly match: Individual, Partnership, Corporation, LLC, Trust, Non-Profit Organisations, Fund/Fund of Funds, IRA, Government Bodies, Education Institutions. Check for typos, extra spaces, and wrong capitalisation.
JSONDecodeError when loading config filesOne of your JSON config files has a syntax error. Run: python -c "import json; json.load(open('configs/form_keys.json'))" for each file to find the error. Common issues: trailing commas, unquoted keys, single quotes instead of double quotes.
5. Server Port Errors
OSError: [Errno 98] Address already in use (port 8001)Change the port with PORT=8002 in .env - or find and kill the process: lsof -i :8001 then kill -9 <PID>.
PORT environment variable always overrides the server.port value in config.ini. If the server starts on the wrong port, check that PORT is not set in your shell or .env.6. Troubleshooting Quick Reference
A quick-reference table for the most common problems across all four modules. If the error you are seeing is not listed here, run pdf-autofillr status first — it reports which modules are installed and which are missing required configuration.
End-to-End Setup Guides
Pick the scenario that matches your deployment target and follow the steps in order. Each scenario is self-contained.
install → setup → .env → init-vectors → status → run — complete 7-step flow
# 1. Create virtual environment and install
python -m venv venv && source venv/bin/activate # macOS/Linux
# python -m venv venv && .\venv\Scripts\Activate.ps1 # Windows PowerShell
pip install "pdf-autofillr[all]"
# 2. Scaffold project (creates configs/, data/, .env.example)
pdf-autofillr setup
# 3. Copy and fill in your secrets
cp .env.example .env
# Edit .env — minimum: set OPENAI_API_KEY=sk-...
# Also set chatbot_PDF_PATH=data/input/blank_form.pdf
# 4. Drop your blank PDF
cp /path/to/blank_form.pdf data/input/blank_form.pdf
# 5. Initialize RAG vectors (if RAG_ENABLED=true in .env)
ragpdf init-vectors
# 6. Verify all modules are configured
pdf-autofillr status
ragpdf system-info
# 7. Run the chatbot
chatbot-cli --pdf-path data/input/blank_form.pdf --report
# Or start as a server
chatbot-server --host 0.0.0.0 --port 8000Two terminal processes - mapper on :8000, chatbot on :8001
# .env - chatbot + mapper + RAG (full stack)
OPENAI_API_KEY=sk-...
CHATBOT_LLM_MODEL=openai/gpt-4o-mini
chatbot_PDF_FILLER=mapper
chatbot_PDF_PATH=./data/input/blank_form.pdf
RAG_ENABLED=true
RAG_MODE=inprocess
RAGPDF_EMBEDDING_BACKEND=openai
RAGPDF_OPENAI_EMBEDDING_MODEL=text-embedding-3-small
# mapper_config.ini
# [rag]
# enabled = true
# mode = inprocess
# Run chatbot (mapper and RAG run inprocess - no extra terminals needed)
chatbot-server --host 0.0.0.0 --port 8000EC2 / ECS deployment with IAM role credentials and S3 sessions
# .env - AWS S3 cloud storage
OPENAI_API_KEY=sk-...
chatbot_PDF_FILLER=mapper
chatbot_PDF_PATH=s3://my-pdf-bucket/blank.pdf
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
AWS_REGION=us-east-1
STORAGE=s3
# mapper_config.ini
# [general]
# source_type = aws
# Verify S3 configuration
pdf-autofillr status
# Start the server
chatbot-serverServerless deployment - all config via Lambda environment variables
# Lambda environment variables (AWS console or IaC):
OPENAI_API_KEY=sk-...
chatbot_STORAGE=s3
AWS_OUTPUT_BUCKET=my-chatbot-sessions
AWS_CONFIG_BUCKET=my-chatbot-configs
AWS_REGION=us-east-1
# No AWS credentials needed - Lambda execution role provides access
# Lambda handler:
chatbot.entrypoints.aws_lambda.handler
# Lambda event:
{
"user_id": "investor_123",
"session_id": "session_abc",
"message": "my name is John Smith",
"pdf_path": "s3://bucket/blank.pdf"
}6. Quick Reference Cheatsheet
Minimum .env for each common mode. Copy the block that matches your deployment and fill in the placeholder values.
# ── Chatbot only (data, no PDF) ──────────────
OPENAI_API_KEY=sk-...
CHATBOT_LLM_MODEL=openai/gpt-4o-mini
# ── Chatbot + mapper PDF ──────────────────────
OPENAI_API_KEY=sk-...
CHATBOT_LLM_MODEL=openai/gpt-4o-mini
chatbot_PDF_FILLER=mapper
chatbot_PDF_PATH=./data/input/blank_form.pdf
# ── Doc Upload + mapper PDF ───────────────────
OPENAI_API_KEY=sk-...
DOC_UPLOAD_LLM_MODEL=openai/gpt-4.1-mini
DOC_UPLOAD_PDF_FILLER=mapper
DOC_UPLOAD_PDF_PATH=./data/input/blank_form.pdf
# ── Full stack + RAG ──────────────────────────
OPENAI_API_KEY=sk-...
CHATBOT_LLM_MODEL=openai/gpt-4o-mini
chatbot_PDF_FILLER=mapper
chatbot_PDF_PATH=./data/input/blank_form.pdf
DOC_UPLOAD_LLM_MODEL=openai/gpt-4.1-mini
DOC_UPLOAD_PDF_FILLER=mapper
DOC_UPLOAD_PDF_PATH=./data/input/blank_form.pdf
RAG_ENABLED=true
RAG_MODE=inprocess
RAGPDF_EMBEDDING_BACKEND=openai
RAGPDF_OPENAI_EMBEDDING_MODEL=text-embedding-3-small
LITELLM_LOG=ERROR
PYTHONUTF8=1
# ── S3 cloud storage ─────────────────────────
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
AWS_REGION=us-east-1
STORAGE=s3Essential commands
chatbot-serverStart API server on :8001chatbot-cliInteractive terminal chatbot sessionchatbot-setupInteractive setup wizardcurl localhost:8001/healthCheck server is healthycurl localhost:8001/docsOpen Swagger UI (browser)pytest tests/unit/ -vRun unit tests (fast, no network)docker build -t chatbot-module .Build Docker imagedocker run -p 8001:8001 --env-file .env …Run Docker container.envContains OPENAI_API_KEY and all other secretschatbot_data/User session data - may contain investor PIIconfig.iniBehaviour settings only - no secretsconfigs/*.jsonForm field definitionsDockerfileContainer build instructionsBack to the start
PDFFILLR.AI
The intelligent layer for modern fund
administration. Automating high-stakes
documentation with precision and speed.