mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1020] [Issue]: Claude Subscription provider silently returns empty response when HOME and runtime user diverge (Docker compose) #497
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#497
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aeriondyseti on GitHub (May 19, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1020
Originally assigned to: @cha1latte on GitHub.
Summary
Two related problems in the Claude Subscription provider surface together in Docker: (1) authentication paths break silently when
HOMEdiffers from the runtime user's natural home (the compose default), and (2) when the Claude Agent SDK returns a successful stream with zerotext_deltaevents, the provider yields nothing and the route logs a vague"Empty response from model"warning with no upstream diagnostic. The user is left guessing — they see only"The AI returned an empty response. Try sending your message again."in the UI.Expected behavior
docker compose upand logging into Claude viadocker execshould be able to use a Claude Subscription connection without manually fixing up file paths or symlinks.Actual behavior
(1) Auth path mismatch under compose
docker-compose.ymlsetsHOME=/appon the marinara service.node) viascripts/docker-entrypoint.mjs, butHOMEis preserved from the compose env, not reset tonode's/etc/passwdentry (/home/node).docker execs into the container to install/login with theclaudeCLI, the CLI uses$HOMEto find/write config. Asnode, that's/home/node/.claude/and/home/node/.claude.json— not/app/.claude/where the server-side SDK looks.@anthropic-ai/claude-agent-sdk@0.2.126) had previously written a stub/app/.claude.json(393 bytes, root-owned, nooauthAccount) when something initialized withHOME=/appas root early in container life./home/node/.claude/.credentials.jsonare never consulted.(2) Silent zero-delta stream → "empty response"
Tracing the failure on
ghcr.io/pasta-devs/marinara-engine:latest(commitc247b2eb, pre-#991):query()iterator completes without throwing.content_block_delta { type: "text_delta" }events are produced.claude-subscription.provider.tsyields nothing.generate.routes.ts:6834seesfullResponse.trim() === ""and writes the user-facing error atgenerate.routes.ts:6868:logger.warn— no provider-level diagnostic, no fast-mode state, no billing/model info, no auth-mode indicator.PR #991 partially mitigates (it adds verbose debug logs for the resume path and throws loudly on SDK errors), but a successful-but-empty stream still falls through without an error.
Steps to reproduce
(1) Auth mismatch
docker compose up(usesghcr.io/pasta-devs/marinara-engine:latest).docker exec -it marinara-engine-marinara-1 bash(lands in/appas root, but the npm-installedclaudeCLI typically lives under thenodeuser's home).claudeCLI and runclaude loginas the user it's actually installed for. Credentials land at/home/node/.claude/.credentials.json.[generate] Empty response from model for chat ...at warn level.(2) Silent zero-delta
Same as above. The auth mismatch is one cause; any other cause that produces a zero-delta stream (silent fast-mode downgrade, tool-only assistant response, model refusal, account-tier gating) would produce the same opaque user message.
Workaround (until fixed)
Inside the running container:
These symlinks live in the writable layer and do not persist across
docker compose down. The cleaner workaround is to login with the right HOME from the start:Proposed fixes
A few options, listed cheapest → most thorough:
docker-compose.yml: dropHOME=/app(or setHOME=/home/node).DATA_DIR=/app/datais already explicit, so HOME doesn't need to override the user's natural home for the data dir to land in the right place.scripts/docker-entrypoint.mjs: afterdropPrivileges(), setprocess.env.HOMEto the dropped user'spw_dirfrom/etc/passwdso the SDK and any subprocess inherit the right path.docs/CONFIGURATION.md(Docker section) that subscription users must either (a) login with-e HOME=/appset or (b) accept that the in-containerclaude loginwrites to/home/nodeand won't be visible to the server.claude-subscription.provider.ts, detect the "stream completed AND zero text deltas yielded AND zeroresult.usagetokens" case andthrow new Error("Claude (Subscription) returned no content — likely auth, fast-mode downgrade, or model rejection. Check theclaudeCLI session and the server logs around this timestamp."). The user-facing message can still be friendly, but the server should leave a usable breadcrumb.$HOMElooks like. Cheap to add, valuable for future bug reports.Environment
ghcr.io/pasta-devs/marinara-engine:latest, revisionc247b2ebd6f2b6274cb7284e37d6ad382aafa6ac)Logs, screenshots, or video
Server logs at the time of failure (compose
:latest, fold path, no PR #991):The diagnostic gap: zero provider-level log lines between
[auth-bypass](boot) and[generate] Empty response(route).Files discovered during diagnosis (inside the container):
/home/node/.claude/.credentials.json/home/node/.claude.json/app/.claude/.credentials.json/app/.claude.jsonoauthAccountAdditional context
/app/.claudeand/app/.claude.jsonto the/home/nodeoriginals fully resolved the empty-response symptom — confirms the auth mismatch is the trigger for this specific report.feat/claude-subscription-jsonl-resume) is in flight and partially addresses (4)/(5) above by wrapping the SDK call in a try/catch that re-throws with a friendly prefix. It does not currently catch the "stream completed but yielded nothing" case.claudeCLI's choice to use$HOME(notgetpwuid(geteuid())->pw_dir) is standard Unix behavior and not something to "fix" upstream — the responsibility is on the container to make those resolve to the same place.Template check