launcher.resolve¶
launcher.resolve tells a client which managed launcher the host administrator set for a CLI. A managed launcher is a program that runs the Claude Code CLI on this host. The method reads the managed settings files and answers with the launcher argv, or with the reason why there is none. It never runs the launcher, and it changes nothing on disk.
A client passes a usable argv to process.spawn in its launcher param. A spawn does not read the managed settings itself.
An untagged rule on this page matches build 89cb6289, measured on Linux. A rule that names macOS or Windows was measured there. A (claustrum's own) rule is not measured on the reference.
Request¶
| Parameter | Required | Meaning |
|---|---|---|
cliPath |
yes | The path of the CLI that the launcher is to run. Any non-empty string is accepted, a relative one too. The daemon does not ~-expand it (claustrum's own) (not measured). |
path |
no | A launcher to check, with launcherCheck (c9125eb8). An empty path counts as absent (claustrum's own, not measured). |
launcherCheck |
no | An object: sha256, a list of digests, ownerUid, a uid, and path (c9125eb8). claustrum reads its path for the shape only (Linux and macOS) and checks the launcher (claustrum's own, not measured). See The file check. 13047a51 adds the bool orManagedFolder (The managed folder). |
Response¶
The result has one of four shapes, in this member order:
{"status":"none"}
{"status":"usable","argv":["<launcher>","<arg>",…],"source":"<file>"}
{"status":"unusable","source":"<file>","reason":"<text>"}
{"status":"unreadable","reason":"<text>","path":"<file or folder>"}
| Status | Meaning |
|---|---|
none |
No settings file sets a launcher. |
usable |
argv is the launcher and its arguments. source is the settings file that set it. |
unusable |
A value is set, but the daemon refuses it. reason says why. |
unreadable |
A settings file or the drop-in folder cannot be read. path names it. |
On macOS fault follows reason: missing for a missing launcher, folder or file that cannot run, not_absolute for a bare name (4c111e86, measured on macOS). A processWrapper of 5 gets other (4c111e86, measured on macOS). Any other value that is not a string sends other, other refusals none (claustrum's own).
With a launcherCheck¶
With path and launcherCheck the result has one of two shapes (c9125eb8, measured on Linux):
{"status":"usable","argv":["<path>"],"hostPolicySeen":<bool>}
{"status":"unusable","reason":"<text>","fault":"<fault>","hostPolicySeen":<bool>}
13047a51 can add checked last in both shapes (The managed folder).
argv names path, also when the settings name another launcher. hostPolicySeen is true when a settings file or drop-in holds any key but processWrapper. It is false for processWrapper only, {}, no file (measured on Linux and macOS) and a file that is not JSON (macOS). Also false: a file that is not a JSON object, cannot be read or is over 2 MiB (claustrum's own, not measured). On Linux a launcherCheck with no path gets the second shape and fault not_absolute (c9125eb8, measured on Linux).
The daemon reads the files on every call. The CLAUDE_SSH_MANAGED_LAUNCHER variable does not change a frame (measured on macOS).
The bytes follow Go's default JSON encoder. In a frame, <, &, > and " come out as JSON escapes, and so does U+2028 in an argv. U+0085, U+FFFD and the dash U+2014 (bytes e2 80 94) of the reason texts stay raw.
Errors¶
| Code | Text | Cause |
|---|---|---|
-32602 |
Invalid params |
No params member, a params that is not an object, or a cliPath that is not a string. |
-32602 |
cliPath is required |
{}, "params":null, a null or empty cliPath, or a key with another name (measured on Windows). The cliPath test comes first, so {"path":…} with no cliPath gets it too. |
-32602 |
launcherCheck is required with path |
A path with no launcherCheck (c9125eb8). The error has no data. |
-32602 |
orManagedFolder can't be set with sha256 or ownerUid |
An orManagedFolder of true with a sha256 digest, on macOS and Windows before the host refusal (13047a51, measured on Linux, macOS and Windows). Its place before the file check on Linux is claustrum's own, not measured. An ownerUid of 0 does not count (measured on Linux and Windows). Another one counts (claustrum's own, not measured). |
-32602 |
Invalid params |
An orManagedFolder string (13047a51, measured on Linux, macOS and Windows). Claustrum's own, not measured: another type that is not a bool gets it too, and a null counts as false. |
-32601 |
Unknown method: launcher.<x> |
Another method of the launcher.* namespace. |
Behavior¶
With CLAUDE_SSH_MANAGED_LAUNCHER=1, -install and -probe-cli run the CLI through the launcher too.
The settings files¶
The settings folder (Platform notes) holds the base file managed-settings.json and the drop-in folder managed-settings.d.
- A missing or empty folder answers
none. So does a base file of{}, of zero bytes or of white space only. - The base file is read first, then the drop-ins in name order (byte order) (claustrum's own). A later file with a value wins, and
sourcenames that file. - A drop-in name ends in
.jsonin lower case and does not start with a dot. So.hidden.json,x.JSONanda.jsare skipped. A folder entry and a FIFO entry are skipped, and the FIFO is not opened. - A symbolic link entry is followed, and
sourcekeeps the link path. A dangling link is skipped. A link to a folder makes the answer unreadable. - A regular file named
managed-settings.dis ignored. - A value of the wrong type in a later file is skipped, and the earlier value stays (
b3081b51, measured on Linux). With no earlier value, the refusal of the later file answers (b3081b51, measured on Linux). A later value or refusal replaces an earlier refusal (b3081b51, measured on Linux). - One unreadable file makes the whole answer unreadable, also with a valid base file. The first unreadable file in read order is the one reported (claustrum's own).
- A UTF-8 byte order mark is dropped. A UTF-16LE mark with UTF-16LE text is read. An invalid byte in the file comes out as U+FFFD.
The value¶
Two string keys carry the value: env.CLAUDE_CODE_PROCESS_WRAPPER and processWrapper. In one file the env key wins. An env value of "" counts as unset, so processWrapper answers. A processWrapper of "" counts as unset too (claustrum's own). Each file gives one value, so a later file's processWrapper wins over an earlier file's env key (claustrum's own).
A value that starts with [, after leading white space, is a JSON array of strings. JSON escapes decode, and the metacharacter test does not apply.
Any other value is an argv list, not a shell command:
- A space, U+00A0 and U+FEFF split words. U+0085 does not. The other white space of Go's
unicode.IsSpacesplits words too (claustrum's own). - Double quotes group words, so a quoted metacharacter is fine. Inside double quotes,
\"gives"and\\gives\. Any other backslash stays, so"e\nf"keeps its two characters. - Outside double quotes, a backslash is a plain character, and a
"after it opens a quote. Single quotes are plain characters.
A value that is not a string¶
A processWrapper of a number is unusable, and so is an env value of a number (b3081b51, measured on Linux and macOS). A processWrapper of a boolean, an array or an object is unusable too (b3081b51, measured on Linux). An env of a string counts as unset (b3081b51, measured on Linux and macOS). A processWrapper of null counts as unset (b3081b51, measured on Linux). A string env value wins over a processWrapper of a number (b3081b51, measured on Linux). An env value of null, a boolean, an array or an object is unusable (b3081b51, measured on Linux). A string processWrapper wins over an env value of a number or a boolean (b3081b51, measured on Linux). If the env value and the processWrapper are both refused, or the processWrapper is "", the env refusal answers (b3081b51, measured on Linux).
The reason is <key> must be one string (the launcher and its arguments), not <kind>. <key> is processWrapper or env.CLAUDE_CODE_PROCESS_WRAPPER. <kind> is null, a number, a boolean, an array or an object (b3081b51, measured on Linux).
Unusable reasons¶
The log line writes these texts raw. The frame escapes them as in Response.
| Case | reason |
|---|---|
No launcher: three spaces, a value of two double quotes, [] or [""] |
the value is set but contains no launcher — unset it to run without one, or set it to the absolute path of your launcher |
A later empty JSON element, ["<w>",""] |
the JSON array contains an empty element — remove it, or fill in the value it was a placeholder for |
| A JSON element that is not a string | JSON form must be an array of strings |
Starts with [ and is not valid JSON |
value starts with `[` but is not valid JSON |
An unquoted ; \| & $ ( ) backtick < > |
the value contains an unquoted shell metacharacter (one of ; \| & $ ( ) ` < >) — it is an argv list, not a shell command |
| An open double quote | unterminated double quote |
A later empty "" word |
the value contains an empty `""` token — remove it, or fill in the value it was a placeholder for |
| argv[0] is not absolute | the launcher must be an absolute path, not a bare name resolved via PATH |
argv[0] equals cliPath |
launcher `<argv0>` is Claude Code's own path |
argv[0] ends in .js, .mjs, .ts, .tsx or .jsx (case-sensitive) |
launcher `<argv0>` is a script the SDK would run in place of Claude Code |
| argv[0] is missing, a folder or not executable | launcher `<argv0>` does not exist or is not an executable regular file |
The launcher checks¶
process.spawn runs these same checks, with its command in place of cliPath, after its own first steps.
- The checks test argv[0] only. The launcher arguments are not tested against files.
- The own-path check is a string compare. It comes before the absolute check and the existence check. So
cwith thecliPathcgets the own-path text, and so does a missing/opt/claude/cliwith thatcliPath. - The script check comes before the existence check, so a missing
x.jsgets the script text (claustrum's own). - A symbolic link to an executable file is usable, and
argvkeeps the link path. argv[0] is quoted as parsed, not cleaned or resolved. - A long argv[0] is cut in the text at 256 bytes, back to the start of a character, and
…follows inside the backticks. The log line shows the same cut.argvkeeps the whole path. The exact limit is claustrum's own.
The file check (build c9125eb8)¶
Only Linux runs it (Platform notes). It tests the file at path, or argv[0] of a spawn. <L> is that file and <D> the item at fault. The texts are measured on Linux.
Faults of the file¶
fault |
Case | reason |
|---|---|---|
not_absolute |
A relative path | the launcher must be an absolute path, not a bare name resolved via PATH |
script_suffix |
.js, .ts or .mjs, and .tsx or .jsx (claustrum's own). X.JS passes |
launcher `<L>` ends like a JavaScript or TypeScript source file, and no launcher may. Rename it. |
missing |
Missing, a dangling link or a folder | launcher `<L>` does not exist or is not an executable regular file |
missing |
Mode 0644, or a mount with noexec |
launcher `<L>` is there, but the account that signs in cannot run it (its mode, or a file system mounted noexec) |
links |
A chain of 41 links, a loop of 2 or a self loop (with no digest: claustrum's own, not measured), or a loop in a folder of the path (claustrum's own, not measured) | too many symbolic links (or a loop) lead to launcher `<L>` |
unreadable |
The read fails | launcher `<L>` cannot be read for its digest: <errno text> |
unreadable |
More than 67108864 bytes | launcher `<L>` is larger than 64 MiB, the most that can be checked against a digest |
digest |
No digest of sha256 matches |
launcher `<L>` matches none of the SHA-256 digests in the policy. Run sha256sum on the host to see its digest. |
Faults of the walk¶
fault |
Case | reason |
|---|---|---|
writable |
A group or other write bit on the file or a folder above it, 1777 too (4c111e86, measured on Linux) |
`<D>` can be changed by accounts other than its owner (mode <mode>). Remove that write access. |
owner |
Owned by the uid of the daemon (4c111e86, measured on a FUSE mount) |
`<D>` belongs to the account that signs in (uid <n>). Root must own the launcher and every folder above it. |
owner |
Owned by uid 65534, which ownerUid names, with no digest (4c111e86, measured on Linux) |
`<D>` shows as uid 65534 (nobody), which the policy names as ownerUid. That uid can stand for many accounts, so it counts only if the policy also lists the launcher's SHA-256 digest. Add sha256 to sshHostLauncher. |
owner |
Owned by uid 65534 that no ownerUid names |
`<D>` shows as uid 65534 (nobody), which usually means this login can't see its real owner, as in a sandbox that doesn't map root or on a squashed network export. This login must see root as the owner of the launcher and every folder above it. |
owner |
Owned by another uid (4c111e86, measured with a digest) |
`<D>` belongs to uid <n>. Root must own the launcher and every folder above it. |
Rules of the check¶
<mode>has four octal digits. The group of the file is not tested.- A root file passes with an
ownerUidtoo. AnownerUidlets that uid own them, but never the uid of the daemon, and uid 65534 only with a digest (4c111e86, measured on Linux). AnownerUidin the settings file lifts nothing. - With no digest,
{}or"sha256":[]passes (measured). The file is then not read (claustrum's own, not measured). A digest matches in any letter case. A short one matches nothing. - Links pass, a chain of 40 too. The walk tests
/, each folder down to the file, and the file, after the links. So a folder behind a link has its real path in the text, and a..after a link goes to the parent of its target (4c111e86, measured on Linux). - Each link met on the way to the launcher has its holder folder and the folders above it tested like the others (
4c111e86, measured on Linux). They come first (claustrum's own, not measured). - A path that moves during the check is not refused for the move. A swapped file meets the digest test (
4c111e86, measured on Linux). - A folder high in the path is refused before a lower one. A file that the account cannot run is refused before a writable folder above it (
c9125eb8, measured on Linux). The write test of an item comes before its owner test (4c111e86, measured on Linux). The other order of the tests is claustrum's own.
The managed folder (build 13047a51)¶
On Linux, with an orManagedFolder of true, a path of /etc/claude-desktop-ssh/launcher with nothing there gets the check of /etc/claude-code/desktop-ssh-launcher (measured on Linux). The result ends with "checked":"/etc/claude-code/desktop-ssh-launcher", and argv keeps path. A missing file or a folder there gets launcher `/etc/claude-code/desktop-ssh-launcher` does not exist or is not an executable regular file. Nothing lies at `/etc/claude-desktop-ssh/launcher` either. A write bit gets the text of the walk. Ownership by the login gets `<D>` belongs to the account that signs in (uid <n>), and no account may use a launcher that it can change itself. Sign in as another account, or make root its owner.
Another path, or a usable file at path, gets the plain check with no checked (measured). claustrum's own, not measured: another entry at path, a dangling link there too, the other faults, and the owner text for a folder.
File system kinds (Linux)¶
fault |
Case | reason |
|---|---|---|
writable |
A file system that the walk does not trust, with no digest (4c111e86, measured on Linux) |
`<D>` is on <fs>, so who can change it can't be checked. Keep the launcher and every folder above it on a local disk, such as ext4 or XFS, or in a container's image. |
writable |
/ on NFS, with no digest (4c111e86, measured on Linux) |
`/` is on NFS. Who can change files there can't be checked, so a launcher can't be used on this host. |
Rules of the kinds¶
- ext4, XFS and erofs pass (
4c111e86, measured on Linux). ZFS, squashfs, f2fs, eCryptfs, JFS, ReiserFS and bcachefs pass too (claustrum's own, not measured). exFAT and NTFS3 keep no Unix owner and get the unknown text, like the measured vfat (claustrum's own, not measured). <fs>isNFS,SMB,9p,AFS,Ceph,GFS2,Lustre,GPFS,OCFS2orVxFS(4c111e86, measured on Linux), orFUSE or virtiofs. Any other type isan unknown kind of file system (0x4d44), with its hex. kAFS (0x6b414653) has no row and gets that text.- On these file systems an
ownerUidlifts nothing with no digest. With a digest the owner test runs (4c111e86, on FUSE). The write test runs too (claustrum's own, not measured). An item whose facts cannot be read getsmissingwith the text of the launcher (claustrum's own, not measured). - The text of
/on another kind and the fault of the/row are claustrum's own, not measured.
A kind with no disk (Linux)¶
With no digest, these rows refuse btrfs, tmpfs, ramfs, overlay, and an ext4 or XFS type on tmpfs or ramfs (4c111e86, measured on Linux).
fault |
Case | reason |
|---|---|---|
writable |
/sys/class/bdi lists a 9p-<n> entry |
`<D>` can't be told apart from a 9p share that is mounted on this machine (`findmnt -t 9p` lists it, unless it's outside this container), so who can change it can't be checked. Unmount the share, or keep the launcher and every folder above it on a local disk, such as ext4 or XFS. |
writable |
/sys/class/bdi can't be read or is empty |
`<D>` may be a 9p share: `/sys/class/bdi`, which would show one, can't be read here. So who can change `<D>` can't be checked. Make `/sys` readable to the account that signs in (`mount -t sysfs sysfs /sys`), or keep the launcher and every folder above it on a local disk, such as ext4 or XFS. |
writable |
An ext4 or XFS type, and no 9p entry | `<D>` is on a file system that reports a disk's kind (<hex>) but has no disk behind it, so who can change it can't be checked. Keep the launcher and every folder above it on a local disk, such as ext4 or XFS, or in a container's image. |
Rules of a kind with no disk¶
- A
9p-<n>entry counts also for a 9p mount outside the mount namespace of the daemon (measured). With no such entry, btrfs, tmpfs, ramfs and overlay pass (measured). - With a 9p entry, an ext4 type on a tmpfs gets the 9p text (measured). An erofs or btrfs type with no 9p entry passes (measured).
<hex>is0xef53or0x58465342. - claustrum's own, not measured: the device test (major 0), erofs in the rule, the faults of the last two rows, and the may-be text for an ext4 type. With a digest all three rows pass (measured for the 9p row). The digits-only test of the name is claustrum's own, not measured.
Log lines¶
An unusable or unreadable answer writes one line, at WARN (claustrum's own). A usable or none answer writes none.
[LauncherHandler] managed launcher from <source> refused: <reason>
[LauncherHandler] managed settings unreadable: <path>: <reason>
A repeat of the same line writes nothing. A usable answer between two equal refusals makes the second one log again. A none answer does the same (claustrum's own). A process.spawn refusal writes no [LauncherHandler] line.
An unusable answer to a launcherCheck writes this line. On Linux a repeat of the last reason writes nothing, until a usable answer or another reason comes between (4c111e86, measured on Linux). On macOS every answer to a launcherCheck is macos_host, and a repeat writes nothing too (4c111e86, measured on macOS). There a usable or managed-refused resolve with no launcherCheck comes between, and a rewrite of the managed settings alone does not (4c111e86, measured on macOS). A none or unreadable answer comes between too (claustrum's own, not measured). A -32602 reply to a launcherCheck does not (measured on macOS). On Windows a repeat writes nothing too (4c111e86, measured on Windows). A resolve with no launcherCheck, which answers none there, comes between, and a -32602 launcherCheck is required with path does not (4c111e86, measured on Windows):
Platform notes¶
The settings folder is /etc/claude-code on Linux and /Library/Application Support/ClaudeCode on macOS. CLAUDE_SSH_E2E_MANAGED_SETTINGS_DIR is honored as in Rare states.
On macOS each resolve with a launcherCheck answers unusable with the fault macos_host, before any file test. That holds with no path and with no settings file (c9125eb8). With a path it holds too (claustrum's own, not measured). The reason is This launcher can't be used on a macOS host: an access-control list there can let another account change it unseen. Use a Linux host. (4c111e86, measured with no path).
There is no settings folder, so the daemon reads no file and answers none. CLAUDE_SSH_E2E_MANAGED_SETTINGS_DIR is not read, and no line is logged. Each resolve with a launcherCheck object answers unusable with the fault windows_host and the reason a launcher cannot be applied on a Windows host. 4c111e86 gives it for each shape that was measured on Windows: {}, a path that is missing, relative, a UNC path or the number 5, sha256 as a list, ownerUid, orManagedFolder as true, and rootsLink, also with a top-level path. 13047a51 answers the same (measured on Windows), but not to orManagedFolder as "yes" (Errors). A string, "", a number, true, [] or an array of one object as launcherCheck gets Invalid params, and null counts as absent (4c111e86, measured on Windows). Another value that is not an object gets Invalid params too (claustrum's own, not measured).
Rare states¶
The test variable
A non-empty CLAUDE_SSH_E2E_MANAGED_SETTINGS_DIR in the daemon's environment names another folder. If the system folder has neither the base file nor a .json drop-in, a hidden one included, the daemon reads the other folder. Otherwise it logs this line once per daemon. That no further line comes from the third resolve on is claustrum's own:
Unreadable reasons
| The file | reason |
|---|---|
| Mode 000, daemon not root (Linux and macOS) | permission denied |
| A folder | is a directory |
| A FIFO (answered at once, not opened) | not a regular file |
| More than 2097152 bytes | larger than 2 MiB |
{ |
not valid JSON |
[] or null |
not a JSON object |
| A UTF-16BE mark, or a raw U+00A0 before the JSON | not valid JSON |
| A drop-in folder whose listing fails | the drop-in directory could not be listed: permission denied, with the folder as path |
For a drop-in, the reasons other than is a directory and not valid JSON are claustrum's own.
Differences from the reference¶
No entry of the divergence catalog applies to this method.
The measured cells behind each rule are in the tests and in the reference build history.