Skip to content

Troubleshooting

Sergey Gerasimov edited this page Oct 23, 2026 · 6 revisions

Troubleshooting

Real problems this project has hit, with the diagnosis and the fix. Each entry states the symptom first, because that is what you will actually see.

LangSmith

Every API call returns 403 Forbidden, but /info answers 200

Symptom

Failed to POST https://api.smith.langchain.com/runs/multipart in LangSmith API.
HTTPError('403 Client Error: Forbidden …', '{"error":"Forbidden"}\n')

The same happens with a personal token (lsv2_pt_…) and with a brand-new service key (lsv2_sk_…), with or without X-Tenant-Id, and /info still returns 200 — so it looks like a broken key.

Cause: the LangSmith instance is a property of the organization, not of the key. An organization hosted on the EU instance addressed through the US endpoint is unknown there, so the request is rejected before any scope check. The identical 403 for a valid key, an invalid key, and a random tenant id is the tell.

Fix

python3 scripts/langsmith_key_check.py lsv2_sk_... <workspace-id>
#    US  https://api.smith.langchain.com     -> 403
# OK EU  https://eu.api.smith.langchain.com  -> 200
LANGSMITH_ENDPOINT=https://eu.api.smith.langchain.com
LANGCHAIN_ENDPOINT=https://eu.api.smith.langchain.com

Related traps in the same area

Symptom Cause
403 only on some resources An organization-scoped service key needs the workspace header; the SDK sends it when LANGSMITH_WORKSPACE_ID is set.
Setting LANGCHAIN_ORG_ID changes nothing The SDK never reads it. It uses LANGSMITH_WORKSPACE_ID.
Traces appear in the wrong project LANGSMITH_PROJECT unset, or the key belongs to another workspace.
A key shows in the UI but is rejected It was revoked, or the user who created the PAT is no longer in the organization (PATs inherit the creator's access).

Tracing is enabled but no runs appear

  1. Confirm the app can reach the API: python3 scripts/langsmith_key_check.py <key>.
  2. Check the project name — LANGSMITH_PROJECT defaults to a value that may not be yours.
  3. Look for a single ingest error in the log: tracing failures are logged, never fatal.
  4. Remember the free/Developer tier has hourly and monthly trace ceilings; exceeding them is reported as 429, not 403.

Docker

Permission denied when the container writes to data/

The image runs as UID 10001, so a root-owned bind mount is not writable. Either use the compose named volume, or run as your own UID:

docker run --rm -u "$(id -u):$(id -g)" --env-file .env \
    -v "$PWD/data:/app/data" duedil-agent:latest python -m app.cli ...

The container is unhealthy

docker inspect --format '{{json .State.Health}}' duedil-agent-ui | python3 -m json.tool
curl -sS http://127.0.0.1:8501/_stcore/health   # expect: ok

The healthcheck has a 20 s start period; a slow first boot on a loaded machine can need a retry.

.env seems ignored inside the container

docker compose reads .env for variable interpolation, not to inject it into the container. The compose file sets env_file: .env explicitly — if you run docker run by hand, pass --env-file .env.

Application

The memo says _(Generated without LLM: …)_

The LLM call failed. The parenthesised reason is the actual error. Usual causes: no OPENAI_API_KEY, an expired key, or no egress to the provider. The pipeline is designed to finish in this state, so it is a warning about depth, not a crash.

"Market data unavailable" in the memo

TAVILY_API_KEY is unset. The analysis continues without external verification, which also silences the traffic-based rules by design.

Every deck extracts as [NOT_FOUND]

The LLM is not returning JSON. Check the model id in DUE_DIL_MODEL and whether the provider is reachable; _safe_json() tolerates code fences, but not prose.

PDF parsing fails with ParserError on a scanned deck

Scanned pages are images. pypdf extracts nothing from them; LlamaParse (with LLAMA_CLOUD_API_KEY) handles them far better. If neither works, the deck needs OCR.

A hosted app answers 303 to curl — that is not a privacy problem

Checking the hosted demo with curl returns 303 with a location pointing at share.streamlit.io/-/auth/app, which looks exactly like an app that is private. It is not: Streamlit Cloud answers the same way for any app, including ones that are certainly public (verified against llm-examples.streamlit.app), because the 303 is how it handles a request that is not a browser session. Use a real browser to judge visibility — a public app loads its UI and returns 200 with the app's own Server/HTML; a private one never renders.

The hosted app loads but stays empty (spinner, no content)

The frontend is served while the Python process is not serving the app — the page returns 200 with zero rendered text. Distinguish the causes:

Observation in the Cloud logs Cause
ends after Uvicorn server started on :::8501, nothing after the script never ran, or the container was killed; check resource limits and the viewport at the bottom of Manage app
ModuleNotFoundError / ResolutionImpossible dependency install failed
the app was recently made public or renamed a redeploy is in flight — Reboot the app

Before blaming the code, reproduce the exact environment locally; it is cheap and decisive:

docker build -t repro -f - . <<'EOF'
FROM python:3.14-slim
WORKDIR /app
COPY requirements.txt ./
RUN python -m pip install --no-cache-dir -r requirements.txt
COPY app ./app
COPY .streamlit ./.streamlit
CMD ["python", "-m", "streamlit", "run", "app/ui.py", "--server.port=8501", "--server.address=0.0.0.0"]
EOF
docker run --rm -p 8501:8501 repro

If that renders and the hosted one does not, the difference is the platform — start with the Python runtime shown in the log (Using Python X.Y.Z environment) and try another version.

A blank hosted page: what turned out to be true

A long debugging session on Community Cloud ended with a boring answer, worth recording so it is not repeated:

Check Result
Cloud log after the last restart Uvicorn server started, then no 🔌 Disconnecting... for hours — the app was healthy
A three-line app from the same repository rendered fine → the platform runs arbitrary scripts
curl and a headless browser from a datacenter IP blank page every time, no console error
The same URL in the owner's home browser full UI, working pipeline
Three hypotheses reproduced locally (Python 3.12 vs 3.14, starlette 1.7.0 vs 0.49.1, exact runtime in Docker) all fine → hypotheses dead

Conclusions. (1) A blank page seen from one machine is not proof that an app is down: the platform can serve the frontend shell to some clients and not others, and it appears to treat datacenter traffic differently. Before believing a blank render, check the log for repeated Disconnecting / restart cycles — a healthy log plus a blank page from a datacenter means the observation point is the problem. (2) curl tells you nothing about a Streamlit Cloud app; see the 303 entry above.

scripts/import_probe.py — when a blank page is the app's fault

If the log does show restart cycles and still no traceback, use the staged import probe: it imports the whole dependency chain one step at a time and prints every result to the page and to stdout, so the last line in the Cloud log names the import that killed the process. Deploy it as its own app (Main file path: scripts/import_probe.py) because the platform no longer offers a branch/file switcher for existing apps. If every import passes, the probe renders the real UI, so it doubles as a drop-in entry point.

pyarrow is replaced on Community Cloud

The platform log contains a deliberate substitution:

Detected pyarrow 25.0.1 (known segfault, apache/arrow#50471). Replacing with pyarrow<25.

That is Streamlit's own workaround, not a failure — the pinned pyarrow is downgraded inside the Cloud environment. Expect the Cloud log to disagree with the lockfile in exactly this way; it is not drift in the repository.

Hosted app runs a mix of two revisions (TypeError about an argument)

Symptom: the app works until a specific button is pressed, then shows

TypeError: This app has encountered an error. The original error message is redacted...
File "/mount/src/duedil-agent/app/ui.py", line 288, in main
    data=markdown_to_pdf_bytes(memo, model=state.get("used_model") or ""),

while the same code runs fine locally and CI is green. That is not a code bug: the deployment is running a new ui.py with an old report.py, so a call passes a keyword the stale definition does not accept. It happened once, after app/ui.py and app/report.py changed in the same commit and the platform refreshed only part of the checkout.

Two ways to confirm it is stale state rather than a real defect:

  1. Line numbers. The traceback names file and line, and the repository is the source of truth: raw.githubusercontent.com/<owner>/<repo>/main/app/ui.py — if the line there is the same as in the traceback, the UI is current and the other module is old.
  2. Compare the deployed revision's history. git log -S'model: str = ""' -- app/report.py shows the commit that introduced the parameter; anything before it lacks it.

Fix — force a clean checkout and a fresh interpreter, in this order:

  1. Manage app → ⋮ → Reboot;
  2. if the traceback survives the reboot, ⋮ → Clear cache, then Reboot again;
  3. as a last resort, change a trivial value in the app's settings (or the requirements.txt comment) so the platform performs a full rebuild instead of a partial refresh.

Prevention in this repository: tests/test_call_signatures.py walks the AST of app/ and fails when any call passes a keyword argument that no definition accepts. It reproduces this exact incident — with the same line number — if the parameter is removed, so the mistake is caught in CI instead of by a visitor.

Streamlit reruns and loses the result

Any widget change — including the language selector — triggers a rerun and clears the previous run. Change settings first, then run. This is expected Streamlit behaviour, not a bug.

CI

Tests (…) fails with ResolutionImpossible after a dependency bump

A transitive pin moved out of lock-step with its parent (the classic: aiohttp requires multidict<7). Fix by re-freezing the lock rather than editing one line, and add the package to the ignore: list in .github/dependabot.yml with a note until upstream allows it.

test_tooling_pins.py fails after bumping ruff

The ruff version is pinned in three places — .pre-commit-config.yaml, pyproject.toml [dev], and the CI lint job. All three must move together; the test exists precisely because they once drifted and blocked contributors. The same applies to a ruff-pre-commit Dependabot PR, which only touches one of the three.

The coverage badge workflow opens a pull request that never merges

Expected. The job pushes with GITHUB_TOKEN, and GitHub suppresses workflow runs for events created by that token, so the required status checks never report on that branch. Merge the badge PR manually — it only touches docs/…/coverage.svg.

Getting help

Channel Use for
GitHub Issues Bugs, unexpected behaviour, documentation gaps.
Security advisories Vulnerabilities — never a public issue.
SECURITY.md Response timeline and scope.

When reporting an application bug, attach the progress_log from the state JSON — it records which node failed and why, which usually identifies the cause immediately.

Last reviewed: 2026-10-23 · Owner: @SergeyGer

Clone this wiki locally