Fix LaunchAgent missing TMPDIR causing SQLITE_CANTOPEN on macOS#20512
Merged
gumadeiras merged 4 commits intoopenclaw:mainfrom Feb 19, 2026
Merged
Fix LaunchAgent missing TMPDIR causing SQLITE_CANTOPEN on macOS#20512gumadeiras merged 4 commits intoopenclaw:mainfrom
gumadeiras merged 4 commits intoopenclaw:mainfrom
Conversation
Forward TMPDIR and LANG from the host environment into the generated LaunchAgent and systemd service environment. macOS launchd does not inherit shell environment variables, so TMPDIR is unset when the gateway runs as a LaunchAgent. This causes SQLite to fail with SQLITE_CANTOPEN because it cannot create journal/WAL temp files in the per-user temp directory (/var/folders/...). LANG is also forwarded to ensure consistent locale behavior for string collation and file I/O encoding. Fixes openclaw#20489 Co-authored-by: Clawborn <tianrun.yang103@gmail.com>
Member
16 tasks
mmyyfirstb
pushed a commit
to mmyyfirstb/openclaw
that referenced
this pull request
Feb 21, 2026
…claw#20512) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 25ba597 Co-authored-by: Clawborn <261310391+Clawborn@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
…claw#20512) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 25ba597 Co-authored-by: Clawborn <261310391+Clawborn@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
lovewanwan
pushed a commit
to lovewanwan/openclaw
that referenced
this pull request
Apr 28, 2026
…claw#20512) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 25ba597 Co-authored-by: Clawborn <261310391+Clawborn@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
ogt-redknie
pushed a commit
to ogt-redknie/OPENX
that referenced
this pull request
May 2, 2026
…claw#20512) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 25ba597 Co-authored-by: Clawborn <261310391+Clawborn@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
May 9, 2026
…claw#20512) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 25ba597 Co-authored-by: Clawborn <261310391+Clawborn@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the gateway runs as a macOS LaunchAgent (installed via
openclaw gateway install), SQLite fails withSQLITE_CANTOPEN: unable to open database fileon every startup.macOS launchd does not inherit shell environment variables. The generated plist includes
HOMEandPATHbut omitsTMPDIR. WithoutTMPDIR, SQLite cannot locate the per-user temp directory (/var/folders/…) needed for journal and WAL files.Running the gateway from an interactive shell works because
TMPDIRis set by the shell.Fix
Forward
TMPDIRandLANGfrom the host environment into the service environment for both gateway and node LaunchAgents.TMPDIR: required by SQLite for temp file creation on macOSLANG: ensures consistent locale for string collation and file encodingBoth are omitted from the plist when unset in the host environment (the existing
renderEnvDictfilter handles this).Tests
4 new test cases covering TMPDIR/LANG forwarding for both gateway and node service environments.
Fixes #20489
Greptile Summary
Forwards
TMPDIRandLANGenvironment variables from the host environment to both gateway and node LaunchAgent services on macOS. This fixes SQLite'sSQLITE_CANTOPENerror that occurs when the gateway runs as a LaunchAgent, whereTMPDIRis needed for SQLite journal and WAL files. TherenderEnvDictfilter ensures these variables are omitted from the plist when unset in the host environment.Confidence Score: 5/5
Last reviewed commit: 296d5ed