Relationships
#2294 swamp serve daemon enable generates a systemd unit with no HOME/SWAMP_HOME, silently disabling extension loading
Opened by skwump_slruper · 9/19/2026· Shipped 9/21/2026
swamp serve daemon enable generates a systemd unit that sets neither HOME nor SWAMP_HOME. Extension loading is therefore disabled in the daemon, and every scheduled workflow that touches a repo-local extension fails with Unknown model type, while the identical workflow passes when run from the CLI.
The contradiction is inside swamp: the daemon installer omits the variable that swamp's own warning says is required when running under a service manager.
Environment
- swamp
20260918.211634.0-sha.bcaa9695, linux-x86_64 - Debian 13 on Proxmox VE, systemd
- Repo at
/root/swampwith a repo-local extension inextensions/models/
Reproduce
swamp repo initin a repo with a local extension underextensions/models/.- Create a model of that type and a workflow with a
trigger.schedule. swamp serve daemon enable --host 127.0.0.1 --port 9090- Wait for the schedule to fire.
Observed at the scheduled time:
system │ Scheduled workflow "estate-offsite" failed: "Unknown model type: @local/estate-offsite"
system │ Scheduled run failed for workflow "estate-offsite": "Unknown model type: @local/estate-offsite"The same workflow run from the CLI in the same repo succeeds, because the CLI inherits HOME.
swamp model type search disagrees with itself depending on which side is asked:
swamp model type search estate --json
→ @local/estate-offsite
swamp model type search estate --server http://127.0.0.1:9090 --json
→ results: [] hint: "No local types matched."Cause, per swamp's own warning
At daemon startup:
[WRN] swamp·cli: 'Extension loading is unavailable: no swamp data directory found
(none of SWAMP_HOME, HOME, or USERPROFILE is set). swamp loads all extensions —
including already-pulled repo extensions — through an embedded runtime under the
swamp data directory. If you run swamp under a service manager such as systemd,
set SWAMP_HOME to an isolated directory, e.g. `Environment=SWAMP_HOME=/opt/swamp`,
or set HOME. Until then, pulled and user extensions are unavailable and workflows
that reference them fail with "Unknown model type".'The generated unit is:
ExecStart="/usr/local/bin/swamp" serve --repo-dir "/root/swamp" --port 9090 --host "127.0.0.1"
WorkingDirectory=/root/swampNo Environment= line at all.
Workaround
# /etc/systemd/system/swamp-serve.service.d/10-home.conf
[Service]
Environment=HOME=/rootWhy this is worth more than the missing line
It fails silently and healthily. systemctl is-active reports active, /ready serves 200, swamp serve daemon status reports running, and the scheduler logs Scheduled execution service started with 1 schedules. Nothing surfaces that every one of those schedules will fail. The only signal is one [WRN] line at startup, and the failure then appears hours later as a per-run error that reads like a repo problem rather than a service-configuration one.
Suggested fixes, in preference order:
daemon enablewritesEnvironment=HOME=…(orSWAMP_HOME=…) into the generated unit, since it already knows the repo directory and the invoking user.- Failing that,
daemon enablerefuses to install a unit that would start with extension loading disabled, and says so at install time rather than at first scheduled run. - Failing both, promote the startup
[WRN]to a readiness failure, so/readydoes not serve 200 while no local extension can load.
Shipped
Click a lifecycle step above to view its details.
stack72 commented 9/21/2026, 9:16:47 PM
Thanks @skwump_slruper for reporting this! We shipped: Set SWAMP_HOME in the generated systemd unit so extension loading works when swamp serve runs as a daemon. The daemon enable command already knows the invoking user and repo directory — it just needs to resolve getSwampDataDir() at enable time and bake the result into the unit as an Environment= line. The plumbing exists in ServiceConfig.env and buildServeService; only the CLI command handler is missing the call.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.
Sign in to post a ripple.