Hit both of these trying to start a service on a real install. They compound: the first stops you finding the service, the second stops it running once you do, and neither produces a useful diagnostic.
$ malt services start mosquitto
error: ServiceNotFound
1. services start <keg> cannot find a service that services list shows
Registration stores the launchd label in name and the formula in keg_name (supervisor.zig:230):
name = com.malt.mosquitto keg_name = mosquitto
but the lifecycle lookup queries name only, so the keg name misses. Every other verb takes the formula name — install mosquitto, uninstall mosquitto, link mosquitto — so the one place that requires the label is the one place a user has no reason to expect it. services list does print the label, but nothing signals that it is the required key.
services status mosquitto fails the same way, via hasService.
2. A service whose working_dir does not exist cannot start, silently
With the label, it registers and bootstraps — then dies:
$ malt services start com.malt.mosquitto
✓ services start: com.malt.mosquitto
$ malt services list
com.malt.mosquitto errored manual mosquitto
$ launchctl list | grep mosquitto
- 78 com.malt.mosquitto
Status 78 is EX_CONFIG. launchd refuses the spawn because WorkingDirectory does not exist — and it refuses it before exec, so StandardErrorPath is never created either. There is no log to read, and nothing anywhere names the offending path. /opt/malt/var/log/ was empty.
The plist referenced two paths that did not exist:
WorkingDirectory → /opt/malt/var/mosquitto ← the EX_CONFIG cause
-c config → /opt/malt/etc/mosquitto/mosquitto.conf
cli/install.zig already pre-creates {prefix}/var/log for exactly this reason; working_dir is the half that got missed, and nothing else in the install path creates it.
mosquitto is a plain example rather than an exotic one: post_install_defined: false, its install block is a bare cmake install, and 2.1.2 ships only .example files — so neither var/mosquitto nor mosquitto.conf is ever created by anyone. (Its caveats claim "installed with a default configuration file", which is inaccurate for this version; that part is upstream's, not malt's.)
Creating the two paths by hand was enough to get it running:
$ malt services list
com.malt.mosquitto running manual mosquitto
$ launchctl list | grep mosquitto
65961 0 com.malt.mosquitto
Scope
Fix for both in the PR that follows. Worth deciding separately whether malt should also seed a missing config file named by a service.run argument, or leave that to the user — I did not do that, since inventing config content is a different kind of decision from creating a directory the plist declares.
Reproduced on 0.22 code; the name/keg_name split and the missing working_dir creation are both present on current main.
Hit both of these trying to start a service on a real install. They compound: the first stops you finding the service, the second stops it running once you do, and neither produces a useful diagnostic.
1.
services start <keg>cannot find a service thatservices listshowsRegistration stores the launchd label in
nameand the formula inkeg_name(supervisor.zig:230):but the lifecycle lookup queries
nameonly, so the keg name misses. Every other verb takes the formula name —install mosquitto,uninstall mosquitto,link mosquitto— so the one place that requires the label is the one place a user has no reason to expect it.services listdoes print the label, but nothing signals that it is the required key.services status mosquittofails the same way, viahasService.2. A service whose
working_dirdoes not exist cannot start, silentlyWith the label, it registers and bootstraps — then dies:
Status 78 is
EX_CONFIG. launchd refuses the spawn becauseWorkingDirectorydoes not exist — and it refuses it before exec, soStandardErrorPathis never created either. There is no log to read, and nothing anywhere names the offending path./opt/malt/var/log/was empty.The plist referenced two paths that did not exist:
WorkingDirectory→/opt/malt/var/mosquitto← the EX_CONFIG cause-cconfig →/opt/malt/etc/mosquitto/mosquitto.confcli/install.zigalready pre-creates{prefix}/var/logfor exactly this reason;working_diris the half that got missed, and nothing else in the install path creates it.mosquitto is a plain example rather than an exotic one:
post_install_defined: false, itsinstallblock is a bare cmake install, and 2.1.2 ships only.examplefiles — so neithervar/mosquittonormosquitto.confis ever created by anyone. (Itscaveatsclaim "installed with a default configuration file", which is inaccurate for this version; that part is upstream's, not malt's.)Creating the two paths by hand was enough to get it running:
Scope
Fix for both in the PR that follows. Worth deciding separately whether malt should also seed a missing config file named by a
service.runargument, or leave that to the user — I did not do that, since inventing config content is a different kind of decision from creating a directory the plist declares.Reproduced on 0.22 code; the
name/keg_namesplit and the missingworking_dircreation are both present on currentmain.